Re: "parameterized views" or return-type-inferring SQL functions?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: "parameterized views" or return-type-inferring SQL functions?
Date: 2010-07-20 05:51:33
Message-ID: 4C453965.4090105@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Oh, sorry for the reply-to-self, but I know I can write an SQL function
with an OUT parameter list to do this. Like creating a custom rowtype
for the job, though, this gets cumbersome if the column-list is long, or
changes to the input tables might ever result in a change to column-list
types, add columns, etc.

Being able to write:

CREATE OR REPLACE FUNCTION blah(IN DATE, OUT a.*, OUT b.*) AS $$
SELECT * FROM a, b;
$$ LANGUAGE 'sql'

... would be somewhat helpful as another form of the ability to expand
rowtypes for use in declarations, but having to list all the OUT
parameters explicitly as I currently do is no better than using CREATE
TYPE to make a custom rowtype or listing all the colums at call-sites
for a RECORD returning function.

--
Craig Ringer

Tech-related writing: http://soapyfrogs.blogspot.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Artur Dabrowski 2010-07-20 07:29:50 Re: Incorrect FTS result with GIN index
Previous Message Craig Ringer 2010-07-20 05:44:41 "parameterized views" or return-type-inferring SQL functions?