Re: Reference new.* or old.* in dynamic statement? - Mailing list pgsql-general

From Richard Huxton
Subject Re: Reference new.* or old.* in dynamic statement?
Date
Msg-id 42F8C5A6.60907@archonet.com
Whole thread Raw
In response to Reference new.* or old.* in dynamic statement?  (Jeff Boes <jeff@endpoint.com>)
List 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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Referencing "less-unique" foreign keys
Next
From: Tom Lane
Date:
Subject: Re: index being ignored for "limit n" queries