Re: BUG #2123: join between stored procedures - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2123: join between stored procedures
Date
Msg-id 23007.1135696528@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2123: join between stored procedures  ("Konstantin S. Zhinko [tIT]" <k.zhinko@grape.ru>)
List pgsql-bugs
"Konstantin S. Zhinko [tIT]" <k.zhinko@grape.ru> writes:
> SELECT b.*
> FROM get_obj_list a
>   LEFT JOIN get_obj(a.id) b ON 1=1
> Error: relation "a" does not exists.

This is not a bug.  You cannot make use of values from one <table
reference> inside the definition of another <table reference>.
So the reference "a.id" is taken to be to a real table named "a",
not to the "a" alias elsewhere in the query.

You could do something like

    SELECT (get_obj(id)).* FROM get_obj_list();

instead.

            regards, tom lane

pgsql-bugs by date:

Previous
From: gotomoon gotomoon
Date:
Subject: Re: BUG #2118: could not connect to server [From zhuge xiao ]
Next
From: Tom Lane
Date:
Subject: Re: BUG #2102: Backend reports wrong number of affected rows for a