Re: Trigger problem

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger problem
Date: 2007-11-27 09:53:36
Message-ID: 20071127095336.GF31593@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christian Rengstl 2007-11-27 10:10:57 Re: Trigger problem
Previous Message Christian Rengstl 2007-11-27 09:38:09 Trigger problem