dbTalk Databases Forums  

[BUGS] ERROR: failed to build any 4-way joins

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] ERROR: failed to build any 4-way joins in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Teodor Sigaev
 
Posts: n/a

Default [BUGS] ERROR: failed to build any 4-way joins - 12-12-2006 , 01:04 PM






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/


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Teodor Sigaev
 
Posts: n/a

Default Re: [BUGS] ERROR: failed to build any 4-way joins - 12-12-2006 , 01:06 PM






Sorry, versions are 8.2 & 8.3. 8.1 works well


--
Teodor Sigaev E-mail: teodor (AT) sigaev (DOT) ru
WWW: http://www.sigaev.ru/

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.