View Single Post

   
  #3 (permalink)  
Old 05-07-2008, 06:20 PM
Michael Monnerie
 
Posts: n/a
Default Re: column: on update update?

On Mittwoch, 7. Mai 2008 Richard Broersma wrote:
> Well you have two options. *The perferred method would be to have
> your application include an update to your lastupdate field whenever
> anyother rows are updated.


But as we speak about SpamAssassin, an external project, I do not want
to patch every new version that comes out. Maybe they include it once,
but it isn't currently so I need the db do it.

> the other option is to add an after update trigger, and manually set
> lastupdate then.


Would that be correct? I never did it and looked purely into docs:

CREATE FUNCTION awlupdate()
AS 'UPDATE awl SET lastupdate=CURRENT_TIMESTAMP;'
LANGUAGE SQL;

CREATE TRIGGER awlupdate AFTER UPDATE ON awl FOR EACH ROW
EXECUTE PROCEDURE awlupdate();

mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0676/846 914 666 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38 500E CE14 91F7 1C12 09B4
// Keyserver: www.keyserver.net Key-ID: 1C1209B4

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQBIIcFfzhSR9xwSCbQRAsMEAKCMHwhB8LjN8bFU2UU8B2 Yzcr2IFwCgoYo1
dkw6KWtNIf06cHK96Y/lde4=
=Kany
-----END PGP SIGNATURE-----

Reply With Quote