X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AC40F476083 for ; Mon, 31 Mar 2003 10:51:17 -0500 (EST) Received: from europa.janwieck.net (h00045a2e4e7c.ne.client2.attbi.com [24.131.181.55]) by postgresql.org (Postfix) with ESMTP id 3076947636E for ; Mon, 31 Mar 2003 10:49:40 -0500 (EST) Received: from Yahoo.com (linksys.janwieck.net [192.168.192.1]) (authenticated) by europa.janwieck.net (8.11.6/8.11.6) with ESMTP id h2VFnMa13025; Mon, 31 Mar 2003 10:49:30 -0500 Message-ID: <3E886379.618F6AE6@Yahoo.com> Date: Mon, 31 Mar 2003 10:49:13 -0500 From: Jan Wieck Organization: Home X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en,ru MIME-Version: 1.0 To: Josh Berkus Cc: Andreas Pflug , pgsql-sql@postgresql.org Subject: Re: How to notice column changes in trigger References: <3E6874CD.4090501@web.de> <200303070941.41276.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-28.5 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/659 X-Sequence-Number: 12697 Josh Berkus wrote: > > Andreas, > > > 1) update test set a=0 -> trigger does its work > > 2) update test set a=0, b=1, c=2 -> trigger does nothing > > 3) update test set a=0, b=b, c=c -> trigger does nothing, but content of > > a and b dont change either although touched > > > IF OLD.b=NEW.b will not work, case 3) will falsely execute the trigger > > code. > > I still don't get why you'd want to do this. Can you provide are real-world > example where there is a difference between setting B=B and not updating B? Setting b=b and not updating it is indeed identical ... at least after the targetlist completion in PostgreSQL. But it is different from b=, and the fact that we cannot distinguish between these two (inside the trigger) prevents us from skipping foreign key checks if your fk-values haven't been touched. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #