Received: from email.nist.gov (email.nist.gov [129.6.2.7]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fA7CiAm01539 for ; Wed, 7 Nov 2001 07:44:11 -0500 (EST) (envelope-from sean@nist.gov) Received: from nist.gov (h185090.nist.gov [129.6.185.90]) by email.nist.gov (8.9.3/8.9.3) with ESMTP id HAA06713 for ; Wed, 7 Nov 2001 07:44:13 -0500 (EST) Message-ID: <3BE92C64.579985CA@nist.gov> Date: Wed, 07 Nov 2001 07:43:16 -0500 From: "Sean K. Sell" Organization: Commerce/NIST X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: update in rule References: <20011107115249.V7681@blue.alter.pl> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by postgresql.org id fA7Cvdn01836 X-Archive-Number: 200111/23 X-Sequence-Number: 2548 If you do the try to set the timestamp AFTER the Update the record is already written and your change would not be refected. THAT is the difference between BEFORE and AFTER as I understand it. Radoslaw Stachowiak wrote: > *** Stephan Szabo [Wednesday, 17.October.2001, 12:04 -0700]: > > create function adresses_trigger() returns opaque as ' > > begin > > NEW.date_maj := now(); > > return NEW; > > end;' language 'plpgsql'; > > create trigger tr before update on adresses for each row execute > > procedure adresses_trigger(); > > why sould I use before (instead of after)? > isnt it a little dangerous in transactions? /hope not/ > > I know difference between both forms. The question is rather about if > timestamp updating shouldnt be run AFTER update which I think is closer > to a real world situations (of course evth vary). But maybe there are > some probles with after, which I dont know about? > > Just being curious... > > -- > radoslaw.stachowiak.........................................http://alter.pl/ > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)