Обсуждение: 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?
Tom Allison <tallison@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
--On Tuesday, May 25, 2004 20:52:22 -0400 Tom Allison <tallison@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: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Вложения
Doug McNaught wrote: > Tom Allison <tallison@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.