Re: returning SETOF RECORD - Mailing list pgsql-hackers

From Robert Haas
Subject Re: returning SETOF RECORD
Date
Msg-id CA+Tgmoa2UTmXf5RGBehQSiiSS=4xHtDh2=2kikBZxJdovLcwgg@mail.gmail.com
Whole thread Raw
In response to Re: returning SETOF RECORD  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: returning SETOF RECORD  (Andrew Dunstan <andrew@dunslane.net>)
Re: returning SETOF RECORD  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Jul 14, 2014 at 4:39 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
>> Is there any reasonable alternative?  That is, if you have a function
>> returning SETOF record, and the details of the record type aren't
>> specified, is there anything you can do other than error out like
>> this?
>
> Not that I can see. What would you suggest?

Dunno.  Was hoping someone else had an idea.  It'd certainly be nice
to have some way of calling functions like this without specifying the
shape of the return value, but I doubt there's a way to make that work
without a lot of new infrastructure.  For example, if a function could
be called at the point where we need to know the record shape with a
special flag that says "just tell me what kind of record you're going
to return" and then called again at execution time to actually produce
the results, that would be nifty.

But mostly, I think it's slightly odd that the function gets called at
all if nothing useful can be done.  Why not just error out in the
caller?  So that made me wonder if maybe there is a way to do
something useful, and I'm just not seeing it.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: returning SETOF RECORD
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_shmem_allocations view