Re: Dyamic updates of NEW with pl/pgsql

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Dyamic updates of NEW with pl/pgsql
Дата
Msg-id 4B9BCC0F.7090308@dunslane.net
обсуждение исходный текст
Ответ на Re: Dyamic updates of NEW with pl/pgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

Tom Lane wrote:
>
> 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.
>
>             
>   

That's exactly the sort of thing I had in mind. I wasn't talking about 
loosening the type system. Classic case: you want to set/update a 
timestamp field in the  NEW record, but it might not be called the same 
thing on each table, so you pass the field name as a trigger argument.

cheers

andrew


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

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