Trying to understand odd trigger behavior - Mailing list pgsql-general

From Bruno Wolff III
Subject Trying to understand odd trigger behavior
Date
Msg-id 20180615040424.GA18759@wolff.to
Whole thread Raw
Responses Re: Trying to understand odd trigger behavior  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: Trying to understand odd trigger behavior  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
I think I know what is happening, but I wanted to see if my understanding 
is correct.

I have a perl after insert trigger for a table with a non-null column element 
and I am getting an occasional error when the trigger executes for 
printing a null value which is $TD->{new}{element}. However, I do the 
insert with an on conflict that converts it into an update. And I have 
a before update trigger that blocks changing the record, but returns null 
if the old and new records are the same.

My theory is that the insert trigger is firing even though the action 
got changed to an update and that because the update trigger cancelled 
the update, there is no new record. So I should just test for $TD->{new} 
being doing before doing stuff.

Does that sound correct?


pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Can I disable sslcert/sslkey in pg_service.conf?
Next
From: Laurenz Albe
Date:
Subject: Re: Trying to understand odd trigger behavior