Re: BUG #2123: join between stored procedures

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Konstantin S(dot) Zhinko [tIT]" <k(dot)zhinko(at)grape(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2123: join between stored procedures
Date: 2005-12-27 15:15:28
Message-ID: 23007.1135696528@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Konstantin S. Zhinko [tIT]" <k(dot)zhinko(at)grape(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-12-27 15:20:52 Re: BUG #2102: Backend reports wrong number of affected rows for a
Previous Message Andrew Dunstan 2005-12-27 14:51:08 Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of copy