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