| From: | Jeff Boes <jeff(at)endpoint(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Joins involving functions |
| Date: | 2006-04-07 21:01:55 |
| Message-ID: | 4436D343.5010802@endpoint.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
I have a function that returns a row from a table, e.g.:
create table foo (a integer);
create function f_foo (integer) returns foo language 'sql'
as $foo$
select * from foo where a = $1 limit 1
$foo$
create table bar (b integer);
select * from bar
cross join f_foo(bar.b) as foo;
Unfortunately, this last statement returns an error:
NOTICE: adding missing FROM-clause entry for table "bar"
ERROR: function expression in FROM may not refer to other relations of
same query level
Is there a method for joining function calls to tables? The only other
approach I can think of is to write another function that returns "setof".
--
Jeffery Boes <><
jeff(at)endpoint(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bryce Nesbitt | 2006-04-07 21:36:01 | Re: How to copy data between joined columns? |
| Previous Message | Scott Marlowe | 2006-04-07 20:34:49 | Re: How to copy data between joined columns? |