From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Trying to understand odd trigger behavior |
Date: | 2018-06-15 06:54:52 |
Message-ID: | 1529045692.3401.1.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Bruno Wolff III wrote:
> 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?
Absolutely, but it should be easy to run a few tests with only a single row
insert that confirms your theory.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
From | Date | Subject | |
---|---|---|---|
Next Message | Fabio Pardi | 2018-06-15 07:45:50 | Re: Faster way of estimating database size |
Previous Message | Bruno Wolff III | 2018-06-15 04:04:24 | Trying to understand odd trigger behavior |