Re: update in rule

From: "Sean K(dot) Sell" <sean(at)nist(dot)gov>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: update in rule
Date: 2001-11-07 12:43:16
Message-ID: 3BE92C64.579985CA@nist.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

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 <sszabo(at)megazone23(dot)bigpanda(dot)com> [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(at)postgresql(dot)org)

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Sean K. Sell 2001-11-07 14:56:56 Re: Problems with user-level security
Previous Message Radoslaw Stachowiak 2001-11-07 10:52:49 Re: update in rule

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2001-11-07 13:57:45 Re: Porting Web application written in Oracle 8 PL/SQL to Postgresql
Previous Message Radoslaw Stachowiak 2001-11-07 10:52:49 Re: update in rule