Re: [GENERAL] rewriting values with before trigger

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: [GENERAL] rewriting values with before trigger
Дата
Msg-id Pine.LNX.4.21.0304241741150.6111-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на rewriting values with before trigger  (Robert Treat <xzilla@users.sourceforge.net>)
Список 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 по дате отправления:

Предыдущее
От: elein
Дата:
Сообщение: Re: [GENERAL] rewriting values with before trigger
Следующее
От: Dennis Gearon
Дата:
Сообщение: Re: [GENERAL] rewriting values with before trigger