Re: return setof : alternatives to holder table
От | Craig Ringer |
---|---|
Тема | Re: return setof : alternatives to holder table |
Дата | |
Msg-id | 4C67D644.9090609@postnewspapers.com.au обсуждение исходный текст |
Ответ на | Re: return setof : alternatives to holder table (Mike Christensen <mike@kitchenpc.com>) |
Список | pgsql-general |
On 15/08/2010 6:18 PM, Mike Christensen wrote: > How about just using OUT parameters? > > CREATE FUNCTION FOO(IN _id uuid, OUT col1 text, OUT col2 text) > RETURNS SETOF record AS > BEGIN > select col1, col2 from test where id=_id; > END; > > Then your output just has to match the signature of the OUT parameters. > And you don't need to define anything when you call it. That works - and in fact is what I often do. For a couple of functions I have a little query that re-generates the OUT param lists based on the contents of the INFORMATION_SCHEMA for those tables and dynamically re-creates the function, too. It'd be kind of nice to have ALTERing a table propagate that sort of change to dependent functions so it didn't have to be manually maintained. Given that it doesn't do that for even views at the momement, though, it'd a pretty minor thing, and after development slows down post-release schema don't tend to change that fast anyway. -- Craig Ringer
В списке pgsql-general по дате отправления: