dbTalk Databases Forums  

[BUGS] Variable not found in subplan target lists, PostgreSQL 8.1 beta3

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


Discuss [BUGS] Variable not found in subplan target lists, PostgreSQL 8.1 beta3 in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jean-Pierre Pelletier
 
Posts: n/a

Default [BUGS] Variable not found in subplan target lists, PostgreSQL 8.1 beta3 - 10-25-2005 , 03:04 PM






Hi,

I have a query that throws error "Variable not found in subplan target
lists".
This should allow it to be reproduce.

create temporary table table1 (
col1 integer not null,
col2 integer not null
);

create temporary table table2 ();

create or replace function udftable1row(integer, integer) returns table1 AS
$$
select $1, $2;
$$ language sql immutable;

create or replace function udf(table1) returns void as $$
$$ language sql immutable;

-- This throws "Variable not found in subplan target lists"
select
udf(t1)
from
udftable1Row(1,2) t1

cross join table2;

-- Now that we have Row constructor, I can get rid of
my function udftable1row() and this works ok

select
udf(t1)
from
(select (cast(row(1,2) as table1)).*) t1

cross join table2;

I am on PostgreSQL 8.1 beta3 under Windows XP Service Pack 2.

Thanks,
Jean-Pierre Pelletier
e-djuster


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

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

Default Re: [BUGS] Variable not found in subplan target lists, PostgreSQL 8.1 beta3 - 10-25-2005 , 03:44 PM






"Jean-Pierre Pelletier" <pelletier_32 (AT) sympatico (DOT) ca> writes:
Quote:
I have a query that throws error "Variable not found in subplan target
lists".
This should allow it to be reproduce.
This seems to be fixed already in beta4. But thanks for the report!

Relevant fix is:

2005-10-19 13:31 tgl

* src/backend/optimizer/plan/createplan.c: Fix oversight in recent
changes to enable the 'physical tlist' optimization for subquery
and function scan nodes: we can't just do it unconditionally, we
still have to check whether there is any need for a whole-row Var.
I had been thinking that these node types couldn't have any system
columns, which is true, but that loop is also checking for attno
zero, ie, whole-row Var. Fix comment to not be so misleading. Per
test case from Richard Huxton.


regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


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.