Re: function to operate on same fields, different records?

Поиск
Список
Период
Сортировка
От Eric G. Miller
Тема Re: function to operate on same fields, different records?
Дата
Msg-id 20010402010419.A2756@calico.local
обсуждение исходный текст
Ответ на Re: function to operate on same fields, different records?  (will trillich <will@serensoft.com>)
Список pgsql-general
On Mon, Apr 02, 2001 at 01:47:29AM -0500, will trillich wrote:
> On Sat, Mar 31, 2001 at 11:52:47AM -0800, Eric G. Miller wrote:
> > I think you still can have a function that uses field names.  But then
> > your field names *have* to be the same.  That's the only difference.
>
> i've tried
>
>     create function gpa(OPAQUE) ....
>
> and psql tells me it successfully
>
>     CREATED
>
> something, but
>
>     \df
>
> shows no such function.
>
> if i do
>
>     create function gpa(classTable) ...
>
> then it probably won't be called via
>
>     select gpa(studentTable) ...
>
> what arg to i specify to allow varying records (with a subset of
> exactly-the-same-names field subset) to be passed to a function?

The trickery only seems to work for trigger functions.

You can duplicate the function definition for each table.  PostgreSQL
will differentiate them not only by name but parameters, so they can all
be called "gpa".  I still think the five parameter function is the most
general approach...

--
Eric G. Miller <egm2@jps.net>

В списке pgsql-general по дате отправления:

Предыдущее
От: Marek PUBLICEWICZ
Дата:
Сообщение: - dumping a tables' 'subtree'
Следующее
От: "Richard Huxton"
Дата:
Сообщение: Re: pg_ctl stop returns error