Re: index suggestion for 7.4 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: index suggestion for 7.4
Date
Msg-id 12533.1054324492@sss.pgh.pa.us
Whole thread Raw
In response to Re: index suggestion for 7.4  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-hackers
Bruno Wolff III <bruno@wolff.to> writes:
> I went back and reread the stuff on NEGATOR and found it only applies
> to operators that return boolean types. I had thought it was different
> and would let you make the deduction a > b <=> -a <= -b, but that isn't
> the case. Instead it lets you make the deduction that a > b <=> NOT (a <= b).

Right, the reason NEGATOR exists is to let prepqual.c flatten out NOTs
where possible (this is the same part of the code that applies
DeMorgan's Laws and other boolean algebra to try to bring a qual
condition into the simplest possible form).

To do something useful with "-" and descending order, we'd need some way
of explicitly associating "-" operators with btree opclasses.  I'm not
convinced that it's worth the trouble, especially when it'd really only
apply to the numeric datatypes ("-" on text is a pretty unappealing
concept...).  Stephan's suggestion of providing standard reverse-order
opclasses seems more attractive to me.  Even if people didn't want to
put them into the mainstream, they could be consed up as a contrib
module with not a lot of effort.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: is it possible to enlarge the TopMemoryContext?
Next
From: "carl garland"
Date:
Subject: Re: RBLs ... I'm tired of spam ...