pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Monnerie <michael.monnerie@it-management.at>
To: pgsql-admin@postgresql.org
Subject: Re: column: on update update?
Date: Wed, 7 May 2008 16:49:03 +0200
Message-ID: <200805071649.03336@zmi.at> (raw)
In-Reply-To: <396486430805070623p360b8eafp39683a287cdb3cc@mail.gmail.com>
References: <200805071050.41450@zmi.at>
	<396486430805070623p360b8eafp39683a287cdb3cc@mail.gmail.com>

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

Attachments:

  signature.asc (application/pgp-signature, 193B) download

view thread (5+ messages)  latest in thread

Message-ID: <200805071649.03336@zmi.at>
Permalink:  ../200805071649.03336@zmi.at/
Also on:    postgresql.org/message-id/200805071649.03336@zmi.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: michael.monnerie@it-management.at
  Subject: Re: column: on update update?
  In-Reply-To: <200805071649.03336@zmi.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox