Re: [SQL] Q:Update Rule

From: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
To: pgsql-sql(at)postgresql(dot)org, "Detlef Boddin S/N O(dot)21" <boddin(at)teleport(dot)de>
Subject: Re: [SQL] Q:Update Rule
Date: 1998-09-21 13:53:51
Message-ID: 1662.980921@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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'

In response to

  • Q:Update Rule at 1998-09-21 10:00:47 from Detlef Boddin S/N O.21

Browse pgsql-sql by date

  From Date Subject
Next Message Deslippe, Michael 1998-09-21 17:56:12 subscribe sql
Previous Message Detlef Boddin S/N O.21 1998-09-21 10:00:47 Q:Update Rule