dbTalk Databases Forums  

Re: [BUGS] extra columns in intermediate nodes not being removed by top level of executor

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


Discuss Re: [BUGS] extra columns in intermediate nodes not being removed by top level of executor in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] extra columns in intermediate nodes not being removed by top level of executor - 09-03-2005 , 04:00 PM






On Sat, Sep 03, 2005 at 04:29:25PM -0400, Allan Wang wrote:
Quote:
I'm using 8.1 from CVS head of about two days ago.

Extra columns seem to be on sum(plays.length), videos.path, videoid
Here's a simplified, complete test case:

CREATE TABLE foo (
x integer,
y integer
);

INSERT INTO foo (x, y) VALUES (1, 2);

SELECT * FROM (SELECT sum(x), (SELECT y) AS yy FROM foo GROUP BY y) AS s LIMIT 1;
sum | yy |
-----+----+---
1 | 2 | 2
(1 row)

SELECT * FROM (SELECT sum(x), (SELECT y) AS yy FROM foo GROUP BY yy) AS s LIMIT 1;
sum | yy
-----+----
1 | 2
(1 row)

SELECT * FROM (SELECT sum(x), (SELECT y) AS yy FROM foo GROUP BY y) AS s;
sum | yy
-----+----
1 | 2
(1 row)

SELECT * FROM (SELECT sum(x), y AS yy FROM foo GROUP BY y) AS s LIMIT 1;
sum | yy
-----+----
1 | 2
(1 row)

SELECT * FROM (SELECT x, (SELECT y) AS yy FROM foo) AS s LIMIT 1;
x | yy
---+----
1 | 2
(1 row)

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] extra columns in intermediate nodes not being removed by top level of executor - 09-04-2005 , 11:23 PM






Michael Fuhr <mike (AT) fuhr (DOT) org> writes:
Quote:
On Sat, Sep 03, 2005 at 04:29:25PM -0400, Allan Wang wrote:
Extra columns seem to be on sum(plays.length), videos.path, videoid

Here's a simplified, complete test case:
Thanks for the test case. The bug seems to be introduced by the code
I added a couple months ago to eliminate unnecessary SubqueryScan plan
nodes: the Limit node ends up with a targetlist different from its
immediate input node, which is wrong because Limit doesn't do any
projection, only pass on its input tuples (or not). There are probably
related cases involving Sort nodes (ORDER BY on a sub-select) and other
plan nodes that don't do projection. Haven't decided on an appropriate
fix yet --- seems we have to either prevent the SubqueryScan from being
removed in this context, or fix the tlist of the parent node. Don't
know which will be less messy.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] extra columns in intermediate nodes not being removed by top level of executor - 09-05-2005 , 12:27 PM



Michael Fuhr <mike (AT) fuhr (DOT) org> writes:
Quote:
On Sat, Sep 03, 2005 at 04:29:25PM -0400, Allan Wang wrote:
Extra columns seem to be on sum(plays.length), videos.path, videoid

Here's a simplified, complete test case:
Patch applied. Thanks for the test case.

regards, tom lane

---------------------------(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.