From: Greg Stark <gsstark@mit.edu>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Merlin Moncure <merlin.moncure@rcsonline.com>
Cc: gsstark@mit.edu, pgsql-performance@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: best way to fetch next/prev record based on index
Date: 28 Jul 2004 01:53:17 -0400
Message-ID: <87oem0u182.fsf@stark.xeocode.com> (raw)
In-Reply-To: <20040727204057.S28969@megazone.bigpanda.com>
References: <6EE64EF3AB31D5448D0007DD34EEB34101AEFF@Herge.rcsinc.local>
<20040727204057.S28969@megazone.bigpanda.com>
Stephan Szabo <sszabo@megazone.bigpanda.com> writes:
> Given the comment on make_row_op,
> /*
> * XXX it's really wrong to generate a simple AND combination for < <=
> * > >=. We probably need to invent a new runtime node type to handle
> * those correctly. For the moment, though, keep on doing this ...
> */
> I'd expect it'd be accepted.
Hm, this code is new. As of version 1.169 2004/04/18 it only accepted "=" and
"<>" operators:
/* Combining operators other than =/<> is dubious... */
if (row_length != 1 &&
strcmp(opname, "=") != 0 &&
strcmp(opname, "<>") != 0)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("row comparison cannot use operator %s",
opname)));
I think perhaps it's a bad idea to be introducing support for standard syntax
until we can support the correct semantics. It will only mislead people and
create backwards-compatibility headaches when we fix it to work properly.
Removing <,<=,>,>= would be trivial. Patch (untested):
inline patch 1: parse_expr.c (+1/-5 lines) download inline-1.patch--- parse_expr.c.~1.174.~ 2004-07-28 01:01:12.000000000 -0400+++ parse_expr.c 2004-07-28 01:52:29.000000000 -0400@@ -1695,11 +1695,7 @@
*/
oprname = strVal(llast(opname));
- if ((strcmp(oprname, "=") == 0) ||- (strcmp(oprname, "<") == 0) ||- (strcmp(oprname, "<=") == 0) ||- (strcmp(oprname, ">") == 0) ||- (strcmp(oprname, ">=") == 0))+ if (strcmp(oprname, "=") == 0)
{
boolop = AND_EXPR;
}
Fixing it to write out complex boolean expressions wouldn't be too hard, but
I'm not clear it would be worth it, since I suspect the end result would be as
the comment indicates, to introduce a new runtime node.
--
greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: gsstark@mit.edu, sszabo@megazone.bigpanda.com, merlin.moncure@rcsonline.com, tgl@sss.pgh.pa.us
Subject: Re: best way to fetch next/prev record based on index
In-Reply-To: <87oem0u182.fsf@stark.xeocode.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox