Using SETOF functions in SQL

From: Pavel Velikhov <pvelikhov(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Using SETOF functions in SQL
Date: 2006-08-15 11:38:08
Message-ID: 20060815113808.39744.qmail@web56409.mail.re3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Is it possible to use a function that returns SETOF and doesn't take constant parameters?

I have a function 'connections(id1 bigint, id2 bigint) returns setof text' that I use to list all paths from id1 to id2. However, I haven't figured out a way to call the function with non-constant functions. For example, if I try to write:

SELECT t1.node, t2.node, path FROM t1,t2, connections(t1.id, t2.id) as path

I get the notorious: ERROR: subquery in FROM may not refer to other relations of same query level

Is there a way to reformulate the query in SQL, or I am stuck with PgSQL now?

Thanks!
Pavel Velikhov
ISP RAS

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2006-08-15 11:59:23 Re: Connection string
Previous Message MaXX 2006-08-15 11:13:23 Partial indexes Vs standard indexes : Insert performance