Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by hub.org (8.10.1/8.11.0) with ESMTP id e9OMqJN90374 for ; Tue, 24 Oct 2000 18:52:20 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id e9OMp3526417; Tue, 24 Oct 2000 18:51:03 -0400 (EDT) To: ldm@apartia.ch cc: pgsql-sql@hub.org Subject: Re: knowing which columns have beend UPDATEd inside a TRIGGER? In-reply-to: <20001024155506.A775@styx> References: <20001024155506.A775@styx> Comments: In-reply-to Louis-David Mitterrand message dated "Tue, 24 Oct 2000 15:55:07 +0200" Date: Tue, 24 Oct 2000 18:51:03 -0400 Message-ID: <26414.972427863@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200010/214 X-Sequence-Number: 1878 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. 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