Re: could not devise a query plan

From: Szűcs Gábor <surrano(at)gmail(dot)com>
To: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: could not devise a query plan
Date: 2005-05-24 10:39:04
Message-ID: 42930447.2030801@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

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)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Szűcs Gábor 2005-05-24 11:55:21 Re: [SQL] could not devise a query plan
Previous Message Russell Smith 2005-05-24 08:56:22 Re: BUG #1677: Bug in select with Union

Browse pgsql-sql by date

  From Date Subject
Next Message Rafa Couto 2005-05-24 10:40:55 Re: Transaction in plpgslq
Previous Message Richard Huxton 2005-05-24 07:45:46 Re: datatype conversion on postgresql 7.4.1