Re: Dyamic updates of NEW with pl/pgsql - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Dyamic updates of NEW with pl/pgsql
Date
Msg-id 4B9BCC0F.7090308@dunslane.net
Whole thread Raw
In response to Re: Dyamic updates of NEW with pl/pgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: David Fetter
Date:
Subject: Re: Dyamic updates of NEW with pl/pgsql
Next
From: Bruce Momjian
Date:
Subject: Re: pq_setkeepalives* functions