On Tue, Feb 09, 2010 at 12:37:32PM +0900, Hitoshi Harada wrote:
> I know "+"/"-" part is an issue. But as far as I know there's been no
> infrastructure to handle such situation. My ideal plan is to introduce
> some mechanism to make "+"/"-" operation abstract enough such like
> sort opclass/opfamily, although I wasn't sure if that is to be
> introduced for this (ie RANGE frame) purpose only.
> 
> 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(). A difficulty may be that
the arguments to these functions are not obvious as in the
(timestamp,interval) case, but if there is only one suitable
possibility I think this can be made to work.

Have a nice day,
-- 
Martijn van Oosterhout   <klep...@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.

Attachment: signature.asc
Description: Digital signature

Reply via email to