Re: [SQL] Adding a rule to update a last_changed field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Grant Kaufmann <grant(at)intekom(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Adding a rule to update a last_changed field
Date: 1999-10-22 18:49:38
Message-ID: 21283.940618178@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Grant Kaufmann <grant(at)intekom(dot)com> writes:
> My original choice was to use a trigger, but I don't want to introduce
> C code when I don't have to. I don't believe that making external calls
> should be necessary for a query that can be so simply expressed in SQL.

Who said anything about C code? I was thinking of a pl/pgsql trigger,
actually. The pl/pgsql section of the manual (programmer's guide under
procedural languages) has an example of almost exactly this problem.

If you do want to stick with rules then you'll need to make sure that
the underlying insert is to a different table than the one the insert
rule applies to --- in other words, create a view and have users insert
into the view.

regards, tom lane

Browse pgsql-sql by date

  From Date Subject
Next Message Zot O'Connor 1999-10-22 19:52:01 Week of year function?
Previous Message Brook Milligan 1999-10-22 16:41:18 Re: [SQL] Adding a rule to update a last_changed field