Re: RETURN QUERY in PL/PgSQL? - Mailing list pgsql-hackers

From Neil Conway
Subject Re: RETURN QUERY in PL/PgSQL?
Date
Msg-id 1178218486.18303.31.camel@goldbach
Whole thread Raw
In response to Re: RETURN QUERY in PL/PgSQL?  ("Pavel Stehule" <pavel.stehule@hotmail.com>)
Responses Re: RETURN QUERY in PL/PgSQL?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Pavel, my apologies for not getting back to you sooner.

On Wed, 2007-25-04 at 07:12 +0200, Pavel Stehule wrote:
> example: I have table with attr. cust_id, and I want to use parametrized 
> view (table function) where I want to have attr cust_id on output.

Hmm, I see your point. I'm personally satisfied with adding a new
proargmode to solve this as you suggest.

> RETURN TABLE is specified in std, and it's last statement.

Where is RETURN TABLE defined in the standard? The only reference to
TABLE I can see is as a <multiset value constructor> (section 6.39 in
the current SQL 200n draft). That would allow RETURN TABLE(...), but it
would also allow TABLE(...) to be used in other contexts. I think
the right place to implement TABLE(...) per the spec would be in the
backend, as part of an implementation of the standard's multiset
concept.

Therefore, we probably should *not* use RETURN TABLE in PL/PgSQL, since
it would induce confusion if we ever do a proper multiset
implementation.

-Neil




pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Sequential scans
Next
From: Tom Lane
Date:
Subject: Re: RETURN QUERY in PL/PgSQL?