From: | Thomas Swan <tswan(at)ics(dot)olemiss(dot)edu> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | BETWEEN patch |
Date: | 2001-01-23 21:17:49 |
Message-ID: | 5.0.2.1.0.20010123150857.04ab3b90@sunset.backbone.olemiss.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
A patch to gram.y in src/backend/parser
Provides for the SQL99 expected behavior of
select * from foo where fo_num between 1 and 5
yields the same result as
select * from foo where fo_num between 5 and 1
Granted this is brute force and not very elegant, however it does provide
the correct behavior. Optimally it would be nice to do a comparison on the
values after between and then sort the two limiters and do a single
rewrite leaving only one pass or scan.
In other words in pseudo SQL:
select * from foo where fo_num between a and b
becomes
select * from foo where ((fo_num >= min_value(a, b)) and (fo_num <=
max_value(a,b))
This would yield only two comparisons or resolutions and then a single
sequential or index scan to find the correct tuples.
This was done against beta1...
Attachment | Content-Type | Size |
---|---|---|
between.patch | application/octet-stream | 1022 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-01-23 21:17:50 | Re: "initdb -t" destroys all databases |
Previous Message | Mikheev, Vadim | 2001-01-23 21:10:34 | RE: Re: AW: Re: MySQL and BerkleyDB (fwd) |