X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE9DE53A71 for ; Thu, 7 Apr 2005 05:47:47 +0100 (BST) 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 28465-04 for ; Thu, 7 Apr 2005 04:47:45 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 104805355A for ; Thu, 7 Apr 2005 05:47:44 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j374lgdM013656; Thu, 7 Apr 2005 00:47:42 -0400 (EDT) To: tjo@acm.org Cc: pgsql-sql@postgresql.org Subject: Re: 9.17.5. Row-wise Comparison In-reply-to: <4254AD87.2030508@acm.org> References: <200504032037.j33Kb1kh016358@hosting.commandprompt.com> <4254AD87.2030508@acm.org> Comments: In-reply-to "TJ O'Donnell" message dated "Wed, 06 Apr 2005 20:48:23 -0700" Date: Thu, 07 Apr 2005 00:47:42 -0400 Message-ID: <13655.1112849262@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/64 X-Sequence-Number: 20957 "TJ O'Donnell" writes: > I've been using syntax like > select a from tbl where (b,c,d) > (1,2,3) > to mean > select a from t where b>1 and b>2 and d>3 > But I see in the manual at: > http://www.postgresql.org/docs/7.4/interactive/functions-comparisons.html#AEN12735 > that only = and <> operators are supported. Does this section of the manual > not properly apply to this query? Is the manual in error, or am I > not understanding? PG's current code acts as you are supposing, but it is broken because it doesn't follow the SQL spec, and we will change it as soon as someone gets around to working on it. The spec says that this syntax implies a column-by-column ordering, essentially if (b > 1) then true else if (b = 1 and c > 2) then true else if (b = 1 and c = 2 and d > 3) then true else false You can find related discussions in the archives from a few months back. The spec's semantics correspond exactly to the sort ordering of a multiple-column btree index, and so there are good reasons why we'd want to provide that behavior even if it weren't mandated by the spec. regards, tom lane