Received: from styx.apartia.int (postfix@d009.dhcp212-48.cybercable.fr [212.198.48.9]) by hub.org (8.10.1/8.11.0) with ESMTP id e9P6NVO05098 for ; Wed, 25 Oct 2000 02:23:31 -0400 (EDT) (envelope-from cunctator@apartia.ch) Received: by styx.apartia.int (Postfix, from userid 1000) id 7BF8E3087; Wed, 25 Oct 2000 08:23:20 +0200 (CEST) Date: Wed, 25 Oct 2000 08:23:20 +0200 From: Louis-David Mitterrand To: Tom Lane Cc: pgsql-sql@hub.org Subject: Re: knowing which columns have beend UPDATEd inside a TRIGGER? Message-ID: <20001025082320.A1941@styx> Reply-To: ldm@apartia.ch Mail-Followup-To: Tom Lane , pgsql-sql@hub.org References: <20001024155506.A775@styx> <26414.972427863@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.9i In-Reply-To: <26414.972427863@sss.pgh.pa.us>; from tgl@sss.pgh.pa.us on Tue, Oct 24, 2000 at 06:51:03PM -0400 X-Archive-Number: 200010/216 X-Sequence-Number: 1880 On Tue, Oct 24, 2000 at 06:51:03PM -0400, Tom Lane wrote: > Louis-David Mitterrand 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.