dynamic OUT parameters?

Поиск
Список
Период
Сортировка
Искать
От
Gerardo Herzig
Тема
dynamic OUT parameters?
Дата
Msg-id
4982DE04.3080206@fmed.uba.ar
Список
Дерево обсуждения
dynamic OUT parameters? Gerardo Herzig <gherzig@fmed.uba.ar>
Re: dynamic OUT parameters? Craig Ringer <craig@postnewspapers.com.au>
Re: dynamic OUT parameters? gherzig@fmed.uba.ar
Re: dynamic OUT parameters? Craig Ringer <craig@postnewspapers.com.au>
Re: dynamic OUT parameters? gherzig@fmed.uba.ar
Re: dynamic OUT parameters? Craig Ringer <craig@postnewspapers.com.au>
Re: dynamic OUT parameters? Ivan Sergio Borgonovo <mail@webthatworks.it>
Re: dynamic OUT parameters? Pavel Stehule <pavel.stehule@gmail.com>
Re: dynamic OUT parameters? Tom Lane <tgl@sss.pgh.pa.us>
Hi all. I have a situation here: I have to make a 'report' for a table.
I'll try to explain the functionality needed:
Lets say i have a table like this
\d people
name varchar
id_city integer (references city(id_city))

\d city
id_city integer
city_name varchar
id_country (references country (id_country))

\d country
id_country integer
country_name varchar

So, if i call report('people') i should return
name	|city		|country
Philip	|Portland	|UEA
Manuel	|Madrid		|España

And so on. This is: "Do *not* include those fields who are FK, instead,
put the referenced keyword from the referenced table".
It is not hard to do this in a query. Is not neither hard to make it a
function. But i have many tables to 'report', and the application leader
does not want querys in the program, just procedures call. So i would
like to have a generic function who should have the logic of 'selecting
the columns to show'. And then i have to ask:

1) There is a way to make a function returning "any amount of any type
of arguments"?

2) Can i make a special type "on_the_fly" and returning setof "that_type"?

3) Should (and/or can) i make a view "on_the_fly" and return from
"that_view"?

Comments awaiting. I hope the explanation is clear enough.
Thanks!
Gerardo

В списке pgsql-sql по дате отправления
От: Gregory Stark
Дата:
Сообщение: Re: regexp_replace and UTF8
От: Harald Fuchs
Дата:
Сообщение: Re: regexp_replace and UTF8
FAQ