X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 64ADED1B74A for ; Wed, 28 Jul 2004 02:53:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74394-02 for ; Wed, 28 Jul 2004 05:53:30 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id C6FA5D1B39A for ; Wed, 28 Jul 2004 02:53:27 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1BphNN-0008Lq-00; Wed, 28 Jul 2004 01:53:17 -0400 To: Stephan Szabo Cc: Merlin Moncure , gsstark@mit.edu, pgsql-performance@postgresql.org, Tom Lane Subject: Re: best way to fetch next/prev record based on index References: <6EE64EF3AB31D5448D0007DD34EEB34101AEFF@Herge.rcsinc.local> <20040727204057.S28969@megazone.bigpanda.com> In-Reply-To: <20040727204057.S28969@megazone.bigpanda.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 28 Jul 2004 01:53:17 -0400 Message-ID: <87oem0u182.fsf@stark.xeocode.com> Lines: 54 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/211 X-Sequence-Number: 7602 Stephan Szabo 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): --- 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