Re: Trigger problem

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Trigger problem
Дата
Msg-id 20071127095336.GF31593@a-kretschmer.de
обсуждение исходный текст
Ответ на Trigger problem  ("Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>)
Ответы Re: Trigger problem
Список pgsql-general
am  Tue, dem 27.11.2007, um 10:38:09 +0100 mailte Christian Rengstl folgendes:
> Hi list,
>
>     act = 'DELETION of row with id: ' || OLD.id;
>                   act = 'UPDATE OF ' || field || ' with id: ' ||
> ...
> INSERT INTO history(aennam, action, table_name) VALUES(current_user,
> act, tab);
>
> Now the problem is that a tuple gets added to the table history, but
> the field "action" (whatever the user did) is 99% empty, whereas the
> others are filled and I don't see why...
>
> Any hint is greatly appreciated

Maybe sometime the concateneted fields (e.g. field, OLD.id) contains
NULL-values. If so, the complete string 'act' will be NULL.

Solution: use coalesce(field,''). Hope that helps.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

В списке pgsql-general по дате отправления:

Предыдущее
От: "Christian Rengstl"
Дата:
Сообщение: Trigger problem
Следующее
От: "Christian Rengstl"
Дата:
Сообщение: Re: Trigger problem