Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group