Re: [GENERAL] rewriting values with before trigger - Mailing list pgsql-sql

From Nigel J. Andrews
Subject Re: [GENERAL] rewriting values with before trigger
Date
Msg-id Pine.LNX.4.21.0304241741150.6111-100000@ponder.fairway2k.co.uk
Whole thread Raw
In response to rewriting values with before trigger  (Robert Treat <xzilla@users.sourceforge.net>)
List pgsql-sql
On 24 Apr 2003, Robert Treat wrote:

> Is there a way to use triggers to rewrite data before determining if the
> data for that field is valid?
>
> ...
>
> postgres=# insert into foo values ('');
> ERROR:  Bad timestamp external representation ''
>
> Is there anyway to do be able to change the '' into NULL before data
> validity is checked with a trigger?
>
> (FWIW this is 7.2, if this would actually work in 7.3 please lmk)

Just so you know 7.3 is the same. I've just been doing something similar,
i.e. wanting to get untyped values into a before trigger but then it's
eminently sensible for that to not be possible.

I hadn't really considered rules but then the process I wanted done was way to
complicated for one of those.

Fortunately the design is such that I could just move the code I would have
written in the trigger into the access function that the middle layer is
supposed to use.


--
Nigel J. Andrews


pgsql-sql by date:

Previous
From: elein
Date:
Subject: Re: [GENERAL] rewriting values with before trigger
Next
From: Dennis Gearon
Date:
Subject: Re: [GENERAL] rewriting values with before trigger