From: Thomas Swan <tswan-lst(at)ics(dot)olemiss(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Date: 2001-01-10 16:10:51
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

At 1/9/2001 10:29 PM, Tom Lane wrote:
>Thomas Swan <tswan-lst(at)ics(dot)olemiss(dot)edu> writes:
> > Shouldn't be much of problem... where would I start to look... :)
>Well, the Right Way To Do It would be to invent a new expression node
>type that implements both kinds of BETWEEN. Right now, the parser
>expands A BETWEEN B AND C into "A >= B AND A <= C", which is perfectly
>correct according to the letter of the spec, but it implies evaluating
>the subexpression A twice, which sucks. Besides which, this doesn't

Actually if it were possible to look at the values before expanding. You
could reorder the expression so that it was always the case that B < C,
then your cost would only be one comparison plus the sequential scan.

>readily generalize to the SYMMETRIC case. I'd make a new expr node
>type with three subexpressions and a SYMMETRIC bool flag. If you chase
>down all the places where CaseExpr nodes are processed, and add a
>BetweenExpr case in parallel, you'll have it made.
> regards, tom lane

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-01-10 16:43:03 Re: Re: Beta2 ... ?
Previous Message Pete Forman 2001-01-10 15:45:38 Re: AW: Re: tinterval - operator problems on AIX