Re: dynmic column names inside trigger? - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject Re: dynmic column names inside trigger?
Date
Msg-id 20071122135403.GA10426@apartia.fr
Whole thread Raw
In response to Re: dynmic column names inside trigger?  ("Bart Degryse" <Bart.Degryse@indicator.be>)
Responses Re: dynmic column names inside trigger?  ("Bart Degryse" <Bart.Degryse@indicator.be>)
List pgsql-sql
On Wed, Nov 21, 2007 at 09:14:14AM +0100, Bart Degryse wrote:
> I would do something like this (not tested, but conceptually working):

Hello,

> BEGIN
> if old.story is not null and new.story != old.story then
>   new.story = sanitize_text(new.story);
> end if;
> --checks on other field can be included here, eg
> if old.otherfield is not null and new.otherfield != old.otherfield then
>   new.otherfield = sanitize_text(new.otherfield);
> end if;

But if I test a non-existent column for not being null I will have an 
exception, no?

Otherwise this is a nice way of doing it.

Thanks,


pgsql-sql by date:

Previous
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: How to have a unique primary key on two tables
Next
From: Louis-David Mitterrand
Date:
Subject: Re: dynmic column names inside trigger?