Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B29E9B5DBF1 for ; Mon, 8 Aug 2011 12:01:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 45248-02 for ; Mon, 8 Aug 2011 15:01:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5DBB8B5DBD5 for ; Mon, 8 Aug 2011 12:01:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p78F1Wms025702; Mon, 8 Aug 2011 11:01:32 -0400 (EDT) To: "Kevin Grittner" cc: "listar" , pgsql-bugs@postgresql.org Subject: Re: BUG #6154: wrong result with nested left-joins In-reply-to: <4E3FA39B020000250003FC1F@gw.wicourts.gov> References: <201108081313.p78DDX6W021751@wwwmaster.postgresql.org> <4E3FA39B020000250003FC1F@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Mon, 08 Aug 2011 08:51:39 -0500" Date: Mon, 08 Aug 2011 11:01:32 -0400 Message-ID: <25701.1312815692@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.711 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.811 X-Spam-Level: X-Archive-Number: 201108/66 X-Sequence-Number: 30878 "Kevin Grittner" writes: > "listar" wrote: >> PostgreSQL version: 8.4.5 >> Description: wrong result with nested left-joins >> And this is the problem - value2 can't be NULL because of COALESCE >> in sub4 (at least I think that it can't be =)) > This works correctly in release 9.0.4 and development HEAD. I > don't still have any machines handy which are running 8.4, but you > might want to try it on the latest bug-fix version of 8.4 (currently > 8.4.8) to see if the fix was back-patched. It works for me too in 8.4.recent; but I believe the relevant fix is in 8.4.5, which makes me doubt the OP's report of his server version. http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=dc9cc887b74bfa0d40829c4df66dead509fdd8f6 regards, tom lane