Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e7CFuju82638 for ; Sat, 12 Aug 2000 11:56:45 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id LAA22819; Sat, 12 Aug 2000 11:56:30 -0400 (EDT) To: Philip Warner cc: pgsql-sql@hub.org Subject: Re: Operator Precedence problem? In-reply-to: <3.0.5.32.20000812154918.01f4e1d0@mail.rhyme.com.au> References: <3.0.5.32.20000812154918.01f4e1d0@mail.rhyme.com.au> Comments: In-reply-to Philip Warner message dated "Sat, 12 Aug 2000 15:49:18 +1000" Date: Sat, 12 Aug 2000 11:56:30 -0400 Message-ID: <22816.966095790@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200008/88 Philip Warner writes: > Which makes me think that the precedence of 'or' is not what I > expected. OR is certainly lower-precedence than AND --- this is hard-wired in the grammar and not subject to change across databases. It's also required by SQL92: ::= | OR ::= | AND ::= [ NOT ] ::= [ IS [ NOT ] ] ::= TRUE | FALSE | UNKNOWN ::= | BTW, I notice that we do not correctly implement the IS tests. The parser turns them into " = 't'::bool" and so on, which is wrong because it will yield NULL for NULL input, which is contrary to the spec for these tests. We need specialized functions comparable to the ones for IS NULL (in fact, IS UNKNOWN should be equivalent to IS NULL except for requiring a boolean input, AFAICT). regards, tom lane