Re: Dyamic updates of NEW with pl/pgsql

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Dyamic updates of NEW with pl/pgsql
Дата
Msg-id 3384.1268500712@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Dyamic updates of NEW with pl/pgsql  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Dyamic updates of NEW with pl/pgsql  (David Fetter <david@fetter.org>)
Re: Dyamic updates of NEW with pl/pgsql  (Andrew Dunstan <andrew@dunslane.net>)
Re: Dyamic updates of NEW with pl/pgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> ... It just doesn't seem right that you should have to
> write N trigger functions over N tables to a highly related
> operations.  pl/perl is a huge dependency to bring in just to able to
> do things this.  I understand hacking things through the text route is
> possibly not a direction should be encouraged...but is there an
> alternative?  Is it theoretically possible to write functions that can
> switch out types based on context while still having static plans?

[ after a little bit of reflection ]

ISTM that in most cases where this is a serious issue, the trigger
functions are doing the *same* thing to different tables.  Not just
textually the same, but datatype-wise the same.  So I'm not sure I
believe that we need to be able to "switch out types".  Maybe it would
work to devise a notation that allows fetching or storing a field that
has a runtime-determined name, but prespecifies the field type.
Actually only the "fetch" end of it is an issue, since when storing the
field datatype can be inferred from the expression you're trying to
assign to the field.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pq_setkeepalives* functions
Следующее
От: David Fetter
Дата:
Сообщение: Re: Dyamic updates of NEW with pl/pgsql