471,108 Members | 1,278 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,108 software developers and data experts.

timestamps

How would I specify a field that's to be updated to current_time
everytime the row is created/altered?

Is there some way to put this 'update' property into the table instead
of running some query to do it?
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #1
3 985


--On Tuesday, May 25, 2004 20:52:22 -0400 Tom Allison
<ta******@tacocat.net> wrote:
How would I specify a field that's to be updated to current_time
everytime the row is created/altered?

Is there some way to put this 'update' property into the table instead of
running some query to do it? You are looking for a trigger.



---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: le*@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAs+92rRNGhTxJvdYRAlFSAKCPnutipCDWNVJY3I2IYu btsdkshQCfVFKG
x84g0s4UguwUQ3/ti1tzBGQ=
=sVW0
-----END PGP SIGNATURE-----

Nov 23 '05 #2
Tom Allison <ta******@tacocat.net> writes:
How would I specify a field that's to be updated to current_time
everytime the row is created/altered?
Create a trigger. There are some good examples in the PL/pgSQL docs.
Is there some way to put this 'update' property into the table instead
of running some query to do it?


Triggers are the way to go in Postgres.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #3
Doug McNaught wrote:
Tom Allison <ta******@tacocat.net> writes:

How would I specify a field that's to be updated to current_time
everytime the row is created/altered?

Create a trigger. There are some good examples in the PL/pgSQL docs.

Is there some way to put this 'update' property into the table instead
of running some query to do it?

Triggers are the way to go in Postgres.

-Doug


Thanks for the pointer. That should be enough.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by lkrubner | last post: by
10 posts views Thread by Craig Wahlmeier | last post: by
5 posts views Thread by Robert Schuldenfrei | last post: by
4 posts views Thread by Craig G | last post: by
1 post views Thread by Erwin Van de Velde | last post: by
3 posts views Thread by rAinDeEr | last post: by
16 posts views Thread by maruk2 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.