Re: rewriting values with before trigger

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: rewriting values with before trigger
Date: 2003-04-24 16:46:01
Message-ID: Pine.LNX.4.21.0304241741150.6111-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message sweatjejm 2003-04-24 16:48:55 function security issue
Previous Message Josh Berkus 2003-04-24 16:39:54 Re: [SQL] rewriting values with before trigger

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Treat 2003-04-24 18:38:14 Re: [SQL] rewriting values with before trigger
Previous Message Josh Berkus 2003-04-24 16:39:54 Re: [SQL] rewriting values with before trigger