From: Michael Monnerie <michael.monnerie@it-management.at>
To: pgsql-admin@postgresql.org
Subject: column: on update update?
Date: Wed, 7 May 2008 10:50:41 +0200
Message-ID: <200805071050.41450@zmi.at> (raw)
Hi, I fear this is a beginners question but I'm no SQL guru and couldn't
find it out of the documentation.
For SpamAssassin, I have a table "awl" (auto white list), and there
should be one field "lastupdate". I added it like this:
ALTER TABLE awl add column lastupdate timestamp default now();
But I also need the "lastupdate" be updated every time a field in that
row is updated, so a statement like this:
ALTER TABLE awl add column lastupdate2 timestamp default now() on update
set now();
But it doesn't work. Do I need a trigger? If yes, what would be the
format? I never did triggers.
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
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: <200805071050.41450@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