Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Admin > Re: column: on ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 4962 of 5407
Post > Topic >>

Re: column: on update update? [solved]

by michael.monnerie@[EMAIL PROTECTED] (Michael Monnerie) May 8, 2008 at 09:41 AM

--nextPart1348169.qVX2Uvafgb
Content-Type: text/plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Mittwoch, 7. Mai 2008 Tom Lane wrote:
> No, the trigger command has to be BEFORE UPDATE not AFTER UPDATE for
> this to work. =A0This is definitely the better way though because the
> row only gets updated once, not stored and then updated again
> (in fact, I think you could get into an infinite loop if an AFTER
> UPDATE trigger tries to update the row again).

OK, here's the final correct syntax (examples missed the () at the=20
function name):

CREATE FUNCTION awlupdate() RETURNS TRIGGER AS '
BEGIN
	NEW.lastupdate =3D now();
	RETURN NEW;
END' LANGUAGE plpgsql;

CREATE TRIGGER awlupdate BEFORE UPDATE ON awl FOR EACH ROW EXECUTE=20
PROCEDURE awlupdate();

Thanks for your help! It's a bit complex just for an update, but it=20
works. :-)

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 --im****t"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: www.keyserver.net                   Key-ID: 1C1209B4

--nextPart1348169.qVX2Uvafgb
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)

iD8DBQBIIq6PzhSR9xwSCbQRAqWZAKCrjQxbSyuHO71ihPjjC0SJVpaCOACfekzP
yVbq8tul3WDqnbY7DiQso6M=
=Qu08
-----END PGP SIGNATURE-----

--nextPart1348169.qVX2Uvafgb--
 




 6 Posts in Topic:
column: on update update?
michael.monnerie@[EMAIL P  2008-05-07 10:50:41 
Re: column: on update update?
richard.broersma@[EMAIL P  2008-05-07 06:23:04 
Re: column: on update update?
michael.monnerie@[EMAIL P  2008-05-07 16:49:03 
Re: column: on update update?
gergely.czuczy@[EMAIL PRO  2008-05-07 16:52:26 
Re: column: on update update?
tgl@[EMAIL PROTECTED] (T  2008-05-07 11:27:54 
Re: column: on update update? [solved]
michael.monnerie@[EMAIL P  2008-05-08 09:41:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 23:13:06 CDT 2008.