X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A6DD0528C8 for ; Tue, 24 May 2005 07:40:18 -0300 (ADT) 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 90552-06 for ; Tue, 24 May 2005 10:40:09 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 4E35E528CC for ; Tue, 24 May 2005 07:40:08 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so182451wra for ; Tue, 24 May 2005 03:40:07 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=F2YtVXxCNf3/o7TNpKFFXBXylYU3nk2s2P0Uepnf0chn4ouYcxNldLE8rxZxaoO1uEjVzXE3AucNl2F08PmA2HXgeLpiJfArJLrpAWQSDhJnQ4DaLGS/CM/3PP3p75BBvsWF2X4JPgLRJJ1Km8Mqldenq5HiW/pfCCS1K5TXv9s= Received: by 10.54.8.33 with SMTP id 33mr430100wrh; Tue, 24 May 2005 03:40:06 -0700 (PDT) Received: from ?192.168.3.4? ([81.182.248.121]) by mx.gmail.com with ESMTP id 13sm1084954wrl.2005.05.24.03.40.06; Tue, 24 May 2005 03:40:06 -0700 (PDT) Message-ID: <42930447.2030801@gmail.com> Date: Tue, 24 May 2005 12:39:04 +0200 From: =?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-bugs@postgresql.org" , "pgsql-sql@postgresql.org" Subject: Re: could not devise a query plan References: <05d801c41bd8$daf4f8f0$0403a8c0@fejleszt4> In-Reply-To: <05d801c41bd8$daf4f8f0$0403a8c0@fejleszt4> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.528 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, RCVD_BY_IP, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200505/197 X-Sequence-Number: 11901 Dear Gurus, Sorry for upping a 13-month-old thread; please tell if I should've opened another one. Here I come again, with another silly join. Please forgive me, but our queries are built from blocks :) VERSION: 7.4.6, 7.4.8, 8.0.0rc4 (sorry, no newer installed right now) ABSTRACT: The following query fails. SELECT * FROM (SELECT a,b FROM cdqp WHERE a=1 AND b=2) AS aa NATURAL FULL JOIN (SELECT a,b FROM cdqp WHERE a=1 and b=2) AS bb WHERE a+b = 3; DETAILS: It seems it's something about the redundant WHERE clauses. If I comment (replace with "WHERE true") any of the three WHERE clauses, it works. Session log: See below. TIA, -- G. serv1:tir=> \d cdqp Table "pg_temp_20.cdqp" Column | Type | Modifiers --------+---------+----------- a | integer | b | integer | serv1:tir=> SELECT * FROM serv1:tir-> (SELECT a,b FROM cdqp WHERE a=1 AND b=2) AS aa serv1:tir-> NATURAL FULL JOIN serv1:tir-> (SELECT a,b FROM cdqp WHERE a=1 and b=2) AS bb serv1:tir-> WHERE a+b = 3; ERROR: could not devise a query plan for the given query serv1:tir=> SELECT * FROM serv1:tir-> (SELECT a,b FROM cdqp WHERE a=1 AND b=2) AS aa serv1:tir-> NATURAL FULL JOIN serv1:tir-> (SELECT a,b FROM cdqp WHERE a=1 and b=2) AS bb serv1:tir-> WHERE true; a | b ---+--- 1 | 2 (1 row)