Re: Problem with trigger makes Detail record be invalid - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Problem with trigger makes Detail record be invalid
Date
Msg-id 5cae1bca-4536-bc12-e74f-12a2fff95452@aklaver.com
Whole thread Raw
In response to Re: Problem with trigger makes Detail record be invalid  (PegoraroF10 <marcos@f10.com.br>)
Responses Re: Problem with trigger makes Detail record be invalid  (PegoraroF10 <marcos@f10.com.br>)
List pgsql-general
On 04/19/2018 11:30 AM, PegoraroF10 wrote:
> I know my trigger is incorrect. I know that I can use TG_OP to know what
> operation is being done.
> My question is ...
>> Is this a bug or it´s mine responsability to check that trigger result ?
> 
> I think it´s a bug because if something got wrong on detail deletion and it
> was rolled back, how could be a parent record be deleted ?

In your example I saw no rollback or error message:

"delete from Master where ID=2;
select * from Master; --will show no records.
select * from Detail; --will show one record pointing to Master_ID=2, that
doesn´t exist anymore."

Was there an error message?

Then there is the fact that your trigger is doing something to the row 
BEFORE the delete or update and presumably modifying it. Without knowing 
what the function is doing or what it is actually returning then we are 
in full on guessing mode.

> 
> 
> 
> --
> Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Doubts about replication..
Next
From: Adrian Klaver
Date:
Subject: Re: Problem with trigger makes Detail record be invalid