ERROR: failed to build any 4-way joins
- From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
- To: pgsql-bugs(at)postgresql(dot)org
- Subject: ERROR: failed to build any 4-way joins
- Date: Tue, 12 Dec 2006 22:03:31 +0300
- Message-id: <457EFD03.10903@sigaev.ru> <text/plain>
Test suite (as simple as I can produce):
CREATE TABLE foo (a int, b int);
INSERT INTO foo VALUES (1,2);
INSERT INTO foo VALUES (2,3);
INSERT INTO foo VALUES (3,3);
CREATE VIEW fooview AS
SELECT
f1.a AS a_for_max_b
FROM
( SELECT MAX(foo.b) AS MaxB FROM foo ) f2
INNER JOIN foo f1
ON f2.MaxB = f1.b;
And this query fails:
SELECT
*
FROM
fooview fv1
LEFT OUTER JOIN fooview fv2
ON TRUE = TRUE;
It also fails with RIGHT join, but it doesn't fail with INNER or FULL joins.
If view is defined (essentially the same) as
CREATE VIEW fooview AS
SELECT
f1.a AS a_for_max_b
FROM
foo f1
WHERE
f1.b = (SELECT MAX(f2.b) FROM foo f2);
then all is ok.
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/
Home |
Main Index |
Thread Index