Re: Re: Functions returning sets - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Re: Functions returning sets
Date
Msg-id 01ae01c0e0bc$c7f94710$0205a8c0@jecw2k1
Whole thread Raw
In response to RE: Re: Functions returning sets  (Mike Mascari <mascarm@mascari.com>)
List pgsql-hackers
> I see Tom Lane implemented the SQL92 feature of using subselects in
> FROM clauses:
>
> CREATE TABLE foo (
> key integer not null,
> value text);
>
> SELECT * FROM (SELECT * FROM foo) AS bar
> WHERE bar.key = 1;
>
> Perhaps this is how functions returning sets should operate:
>
> SELECT titles.* FROM titles, (SELECT funct_set('blah blah')) AS bar
> WHERE titles.title = bar.title;
>

This is exactly what I was thinking. To take it one step further, then you
could define a view as:

CREATE VIEW vw_funct_set as (SELECT funct_set('blah blah'));

Then the statement above might look like:

SELECT titles.* FROM titles, vw_funct_set AS bar WHERE titles.title =
bar.title;

IMHO this seems the most natural way to do what you have proposed.

-- Joe



pgsql-hackers by date:

Previous
From: Don Baccus
Date:
Subject: Re: Functions returning sets
Next
From: bpalmer
Date:
Subject: cvs snapshot compile problems