Re: Trigger problem - Mailing list pgsql-general

From A. Kretschmer
Subject Re: Trigger problem
Date
Msg-id 20071127095336.GF31593@a-kretschmer.de
Whole thread Raw
In response to Trigger problem  ("Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>)
Responses Re: Trigger problem  ("Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>)
List 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 by date:

Previous
From: "Christian Rengstl"
Date:
Subject: Trigger problem
Next
From: "Christian Rengstl"
Date:
Subject: Re: Trigger problem