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 4 of 6 Topic 4962 of 5549
Post > Topic >>

Re: column: on update update?

by gergely.czuczy@[EMAIL PROTECTED] (CZUCZY Gergely) May 7, 2008 at 04:52 PM

--Sig_/ln_MUnkhSftoY9/Pc0FwvQz
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, 7 May 2008 16:49:03 +0200
Michael Monnerie <michael.monnerie@[EMAIL PROTECTED]
> wrote:

> > the other option is to add an after update trigger, and manually set
> > lastupdate then.
>=20
> Would that be correct? I never did it and looked purely into docs:
>=20
> CREATE FUNCTION awlupdate()
>     AS 'UPDATE awl SET lastupdate=3DCURRENT_TIMESTAMP;'
>     LANGUAGE SQL;
>=20
> CREATE TRIGGER awlupdate AFTER UPDATE ON awl FOR EACH ROW
> EXECUTE PROCEDURE awlupdate();

I'd prefer this version:
CREATE FUNCTION awlupdate RETURNS TRIGGER AS '
BEGIN
  NEW.lastupdate =3D now();
  RETURN NEW;
END' LANGUAGE plpgsql;
CREATE TRIGGER... the same.

But both methods are fine. The only thing is, the function must return
TRIG=
GER
AFAIK.



--=20
=C3=9Cdv=C3=B6lettel,

Czuczy Gergely
Harmless Digital Bt
mailto: gergely.czuczy@[EMAIL PROTECTED]
 +36-30-9702963

--Sig_/ln_MUnkhSftoY9/Pc0FwvQz
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (FreeBSD)

iD8DBQFIIcIszrC0WyuMkpsRAn3WAJ9y0GO8tStJ1zxeUegoEN71Q4pAFQCcDgrs
u0IC6H2glTNir6MYQPBpKew=
=PIwA
-----END PGP SIGNATURE-----

--Sig_/ln_MUnkhSftoY9/Pc0FwvQz--
 




 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 Sat Nov 22 17:15:02 CST 2008.