pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Louis-David Mitterrand <cunctator@apartia.ch>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@hub.org
Subject: Re: knowing which columns have beend UPDATEd inside a TRIGGER?
Date: Wed, 25 Oct 2000 08:23:20 +0200
Message-ID: <20001025082320.A1941@styx> (raw)
In-Reply-To: <26414.972427863@sss.pgh.pa.us>
References: <20001024155506.A775@styx>
	<26414.972427863@sss.pgh.pa.us>

On Tue, Oct 24, 2000 at 06:51:03PM -0400, Tom Lane wrote:
> 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.

*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@apartia.org - http://www.apartia.org

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



view thread (4+ messages)  latest in thread

Message-ID: <20001025082320.A1941@styx>
Permalink:  ../20001025082320.A1941@styx/
Also on:    postgresql.org/message-id/20001025082320.A1941@styx

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: cunctator@apartia.ch, tgl@sss.pgh.pa.us, pgsql-sql@hub.org
  Subject: Re: knowing which columns have beend UPDATEd inside a TRIGGER?
  In-Reply-To: <20001025082320.A1941@styx>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox