Re: Returning columns from different tables, in plpgsql function
От
Merlin Moncure
Тема
Re: Returning columns from different tables, in plpgsql function
Дата
Msg-id
b42b73150712080554w7c3bff6bj3dc4c966c3de13c1@mail.gmail.com
Ответ на
Returning columns from different tables, in plpgsql function (Amit Phatarphekar)
Список
Дерево обсуждения
Returning columns from different tables, in plpgsql function "Amit Phatarphekar" <amit@visionaire-us.com>
Re: Returning columns from different tables, in plpgsql function "Merlin Moncure" <mmoncure@gmail.com>
On Dec 7, 2007 6:57 PM, Amit Phatarphekar wrote: > Currently if I have to return columns from multiple tables, I have to define > my own TYPE and then return SETOF that type in the function. I've provided > an example below. > > Now, if I have to add a column to the select query, I have drop the existing > TYPE definition, create a new TYPE with the new column added to it, and then > modify the function sql to return this extra column. > > Question – Is there any other way to doing this? - Is everybody following > the same approach out there? I know I can return a SETOF RECORD type and > then define in the function call, all the columns that are being returned. > But I like TYPE the definition approach better than this anyways. Let me > know if I'm missing anything in the mix. > you can use (in 8.1+) out parameters and define the return type as record. This is probably the best way in terms of management, unless you want to return a type for other reasons. merlin
В списке pgsql-general по дате отправления