X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D7C5DBE00 for ; Fri, 25 Nov 2005 15:59:11 -0400 (AST) 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 77693-06 for ; Fri, 25 Nov 2005 19:59:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 70C73DBE0B for ; Fri, 25 Nov 2005 15:59:05 -0400 (AST) 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 jAPJx3iV026191; Fri, 25 Nov 2005 14:59:03 -0500 (EST) To: David Pradier cc: pgsql-sql@postgresql.org Subject: Re: Order of precedence between AND and OR. In-reply-to: <20051125165259.GE4482@clarisys.fr> References: <20051125165259.GE4482@clarisys.fr> Comments: In-reply-to David Pradier message dated "Fri, 25 Nov 2005 17:52:59 +0100" Date: Fri, 25 Nov 2005 14:59:03 -0500 Message-ID: <26190.1132948743@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/247 X-Sequence-Number: 23498 David Pradier writes: > But what I couldn't find is if there is an order of precedence between > AND and OR, that is if the AND expression is calculated before the OR > one, or anyelse way. AND first; see http://www.postgresql.org/docs/8.1/static/sql-syntax.html#SQL-PRECEDENCE This is required by the SQL spec. But you probably also want to read http://www.postgresql.org/docs/8.1/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL regards, tom lane