Re: Reference new.* or old.* in dynamic statement?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jeff Boes <jeff(at)endpoint(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Reference new.* or old.* in dynamic statement?
Date: 2005-08-09 15:03:02
Message-ID: 42F8C5A6.60907@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Boes wrote:
> I'm trying to write a general-purpose trigger that will disallow updates
> on certain fields (I could probably do this in other ways, but I have a
> stubborn streak ...).
>
> Given a table, I want to define a trigger on that table that will
> "write-protect" one column by name:
>
> CREATE TRIGGER tbl_nomod_create
> BEFORE INSERT OR UPDATE ON tbl
> FOR EACH ROW EXECUTE PROCEDURE
> no_modification_allowed('create_date');

> CREATE OR REPLACE FUNCTION no_modification_allowed()
> RETURNS TRIGGER
> LANGUAGE 'plpgsql'
> AS '

It's a lot easier if you use TCL/Perl/one of the other interpreted
languages. Bound to be an example in the mailing list archives, I might
even have posted one.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-08-09 15:18:09 Re: Referencing "less-unique" foreign keys
Previous Message Tom Lane 2005-08-09 15:02:47 Re: Case sensitivity