pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQ:Update Rule
2+ messages / 2 participants
[nested] [flat]
* Q:Update Rule
@ 1998-09-21 10:00 Detlef Boddin S/N O.21 <boddin@teleport.de>
1998-09-21 13:53 ` Re: [SQL] Q:Update Rule Sferacarta Software <sferac@bo.nettuno.it>
0 siblings, 1 reply; 2+ messages in thread
From: Detlef Boddin S/N O.21 @ 1998-09-21 10:00 UTC (permalink / raw)
To: pgsql-sql
I want to save the user and date in a row when the user changed it.
If I use an update rule, how can I prevent a loop ?
Bad example:
create rule r_changed
as on update to requesttable
do update requesttable
set changed_by = current_user,
date_of_last_change = current_date;
What is better ?
Detlef
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Q:Update Rule
1998-09-21 10:00 Q:Update Rule Detlef Boddin S/N O.21 <boddin@teleport.de>
@ 1998-09-21 13:53 ` Sferacarta Software <sferac@bo.nettuno.it>
0 siblings, 0 replies; 2+ messages in thread
From: Sferacarta Software @ 1998-09-21 13:53 UTC (permalink / raw)
To: pgsql-sql@postgresql.org, "Detlef Boddin S/N O.21" <boddin@teleport.de>
Hello Detlef,
lunedì, 21 settembre 98, you wrote:
DBSNO2> I want to save the user and date in a row when the user changed it.
DBSNO2> If I use an update rule, how can I prevent a loop ?
DBSNO2> Bad example:
DBSNO2> create rule r_changed
DBSNO2> as on update to requesttable
DBSNO2> do update requesttable
DBSNO2> set changed_by = current_user,
DBSNO2> date_of_last_change = current_date;
DBSNO2> What is better ?
There's an example in the directory
pgsql/contrib/spi/insert_username.* that insert the
username when the user update or insert a row into the table.
I modified this example to insert CURRENT_USER and CURRENT_TIMESTAMP
into the row.
It is very sample to implement but if you want I may send it to you.
Jose'
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-09-21 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-09-21 10:00 Q:Update Rule Detlef Boddin S/N O.21 <boddin@teleport.de>
1998-09-21 13:53 ` Sferacarta Software <sferac@bo.nettuno.it>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox