Re: knowing which columns have beend UPDATEd inside a TRIGGER?

From: Louis-David Mitterrand <cunctator(at)apartia(dot)ch>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: knowing which columns have beend UPDATEd inside a TRIGGER?
Date: 2000-10-25 06:23:20
Message-ID: 20001025082320.A1941@styx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

On Tue, Oct 24, 2000 at 06:51:03PM -0400, Tom Lane wrote:
> Louis-David Mitterrand <cunctator(at)apartia(dot)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.

*slap* Doh! Thanks for clearing up my mind about this ;-)

> 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.

That is so obvious I didn't think about it, and it's exactly what I
need.

Thanks a lot,

--
Louis-David Mitterrand - ldm(at)apartia(dot)org - http://www.apartia.org

Hi. This is my friend, Jack Shit, and you don't know him.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tomas Berndtsson 2000-10-25 07:21:52 Re: knowing which columns have beend UPDATEd inside a TRIGGER?
Previous Message S.A.Pamungkas 2000-10-25 04:46:58 connect DB from remote

Browse pgsql-sql by date

  From Date Subject
Next Message Tomas Berndtsson 2000-10-25 07:21:52 Re: knowing which columns have beend UPDATEd inside a TRIGGER?
Previous Message Carolyn Lu Wong 2000-10-25 05:03:10 quote in function