Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id B917A2E0047 for ; Wed, 7 May 2008 05:50:50 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 34249-08 for ; Wed, 7 May 2008 05:50:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailsrv1.zmi.at (mailsrv1.zmi.at [212.69.162.198]) by developer.postgresql.org (Postfix) with ESMTP id A726E2E003C for ; Wed, 7 May 2008 05:50:45 -0300 (ADT) Received: from mailsrv.i.zmi.at (h081217054243.dyn.cm.kabsi.at [81.217.54.243]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mailsrv.i.zmi.at", Issuer "mailsrv.i.zmi.at" (not verified)) by mailsrv1.zmi.at (Postfix) with ESMTP id B2DD3AAA for ; Wed, 7 May 2008 10:51:14 +0200 (CEST) Received: from saturn.i.zmi.at (saturn.i.zmi.at [10.0.0.2]) by mailsrv.i.zmi.at (Postfix) with ESMTP id D93BBBFEF for ; Wed, 7 May 2008 10:49:53 +0200 (CEST) From: Michael Monnerie Organization: it-management http://it-management.at To: pgsql-admin@postgresql.org Subject: column: on update update? Date: Wed, 7 May 2008 10:50:41 +0200 User-Agent: KMail/1.9.6 (enterprise 20070904.708012) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1641173.eaYQIj4IYg"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200805071050.41450@zmi.at> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL=0.013 X-Spam-Level: X-Archive-Number: 200805/45 X-Sequence-Number: 29129 --nextPart1641173.eaYQIj4IYg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I fear this is a beginners question but I'm no SQL guru and couldn't=20 find it out of the documentation. =46or SpamAssassin, I have a table "awl" (auto white list), and there=20 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=20 row is updated, so a statement like this: ALTER TABLE awl add column lastupdate2 timestamp default now() on update=20 set now(); But it doesn't work. Do I need a trigger? If yes, what would be the=20 format? I never did triggers. mfg zmi =2D-=20 // 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 --nextPart1641173.eaYQIj4IYg Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQBIIW1hzhSR9xwSCbQRAhXeAJ0RJXQFteNDOy6cBm2jcLGXlZDaBACfYVRe qCZBVzOFzQv7dzK8hH/VzOI= =1mHq -----END PGP SIGNATURE----- --nextPart1641173.eaYQIj4IYg--