Re: knowing which columns have beend UPDATEd inside a TRIGGER? - Mailing list pgsql-sql

From Tom Lane
Subject Re: knowing which columns have beend UPDATEd inside a TRIGGER?
Date
Msg-id 26414.972427863@sss.pgh.pa.us
Whole thread Raw
In response to knowing which columns have beend UPDATEd inside a TRIGGER?  (Louis-David Mitterrand <cunctator@apartia.ch>)
Responses Re: knowing which columns have beend UPDATEd inside a TRIGGER?
List pgsql-sql
Louis-David Mitterrand <cunctator@apartia.ch> writes:
> Is there a way to know which columns are being UPDATEd or INSERTEd from
> inside a trigger, either in C or pl/pgsql?

Huh?  An INSERT always inserts all columns, by definition.  Some of them
might be null and/or equal to their default values, but they're all
there.

For an UPDATE, you could check to see whether old.col = new.col.
This would miss the case where an UPDATE command is explicitly setting
a column to the same value it already had; dunno if you care or not.
        regards, tom lane


pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Help on Union Query
Next
From: Carolyn Lu Wong
Date:
Subject: quote in function