Received: from acheron.rime.com.au (root@albatr.lnk.telstra.net [139.130.54.222]) by hub.org (8.10.1/8.10.1) with ESMTP id e7C5mfG74440 for ; Sat, 12 Aug 2000 01:48:41 -0400 (EDT) Received: from oberon (Oberon.rime.com.au [203.8.195.100]) by acheron.rime.com.au (8.9.3/8.9.3) with SMTP id PAA27463 for ; Sat, 12 Aug 2000 15:48:56 +1000 Message-Id: <3.0.5.32.20000812154918.01f4e1d0@mail.rhyme.com.au> X-Sender: pjw@mail.rhyme.com.au X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Date: Sat, 12 Aug 2000 15:49:18 +1000 To: pgsql-sql@hub.org From: Philip Warner Subject: Operator Precedence problem? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200008/84 I have a peculiar problem that I can't reproduce on a trivial database: select product, priority, count(*) as completed from issue where product = 'DIS' and create_date < '1-Aug-2000' and finish_date >= '1-Aug-2000' or finish_date is null group by product, priority; This produces a list of all products - not just 'DIS'. If I put the last two clauses in parnthesis, then it works as expected: select product, priority, count(*) as completed from issue where product = 'DIS' and create_date < '1-Aug-2000' and (finish_date >= '1-Aug-2000' or finish_date is null) group by product, priority; Which makes me think that the precedence of 'or' is not what I expected. Is this a feature? If so, the fact that I get precisely the opposite behaviour in simple test databases must be a bug, I think. Any help or explanation would be appreciated... ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/