Re: review: More frame options in window functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: More frame options in window functions
Date: 2010-02-11 20:26:53
Message-ID: 13993.1265920013@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> On Tue, Feb 09, 2010 at 12:37:32PM +0900, Hitoshi Harada wrote:
>> Now that specialized hard-coding "+"/"-" in source seems unacceptable,
>> I would like to hear how to handle this. Is there any better than
>> introducing new mechanism such like opclass?

> I imagine it would be easiest to add these operators to the existing
> opclass infrastructure. Although it didn't start that way, the opclass
> structure is being more and more used to declare the semantics of a
> type. Btree operator classes are for *ordered* types, which seems to be
> the only case you can expect to work here.

> Currently the btree operator classes have only one support function, so
> it would seem than the easiest approach would be to declare two new
> support functions for add() and subtract().

Yeah, that was pretty much the same line of thought I had. The main
disadvantage seems to be two more catalog lookups per index to fill in
support function entries that won't ever be used (at least not by the
index machinery). However, I think we cache that stuff already inside
relcache.c, so it might be insignificant.

The real question is whether it's time to bite the bullet and stop
overloading the opclass infrastructure for semantics-declaration
purposes. Are there any other foreseeable cases where we are going
to need to add operator knowledge of this sort?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-02-11 20:27:41 Re: psql tab completion for DO blocks
Previous Message Tom Lane 2010-02-11 20:18:42 Re: log_error_verbosity function display