Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wu8Jn-0000gA-NW for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Jun 2014 22:45:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wu8Jn-0002WW-6D for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Jun 2014 22:45:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wu547-00008q-Qa for pgsql-bugs@postgresql.org; Mon, 09 Jun 2014 19:17:07 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wu543-0007sn-20 for pgsql-bugs@postgresql.org; Mon, 09 Jun 2014 19:17:06 +0000 MIME-Version: 1.0 Subject: BUG #10587: ERROR: variable not found in subplan target list To: pgsql-bugs@postgresql.org From: geoff@sea-incorporated.com Date: Mon, 09 Jun 2014 19:16:09 +0000 Message-ID: <20140609191609.2586.95459@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 10587 Logged by: Geoff Speicher Email address: geoff@sea-incorporated.com PostgreSQL version: 9.2.8 Operating system: FreeBSD Description: The following SQL has been verified to yield a planner error in 9.2.2 and 9.2.8 (maybe others), but the query succeeds in 9.3.4. create table t1 ( id int primary key, a1 boolean, a2 boolean ); create table t2 ( id int primary key, t1_id int, b1 boolean, b2 boolean, foreign key (t1_id) references t1(id) ); create table t3 ( id int primary key, t2_id int, c1 boolean, foreign key (t2_id) references t2(id) ); insert into t1 values (1,true,true); insert into t1 values (2,true,false); insert into t1 values (3,false,false); insert into t2 values (1,1,true,true); insert into t2 values (2,2,true,false); insert into t2 values (3,3,false,false); insert into t3 values (1,1,true); insert into t3 values (2,2,false); insert into t3 values (3,3,true); select t3.id from t3 as t3 left join (select t2.*, (t2.b1 and t1.a3) AS b3 from t2 as t2 left join (select t1.*, (t1.id is not null) as a3 from t1) as t1 on t1.id=t2.t1_id ) as t2 on t2.id=t3.t2_id where t3.id=1 and t2.b3 ; -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs