Re: Corruption with duplicate primary key - Mailing list pgsql-hackers

From Alex Adriaanse
Subject Re: Corruption with duplicate primary key
Date
Msg-id SN6PR03MB3598F20EE858DA6FD71EB75AA95A0@SN6PR03MB3598.namprd03.prod.outlook.com
Whole thread Raw
In response to Re: Corruption with duplicate primary key  ("Finnerty, Jim" <jfinnert@amazon.com>)
List pgsql-hackers
On Mon, December 9, 2019 at 11:05 AM Finnerty, Jim wrote:
> If you have BEFORE triggers, and a BEFORE trigger signaled failure with RETURN NULL, then this is one known (and
documented)issue that I think could cause the behavior you're reporting: 
>    
>
https://www.postgresql-archive.org/BEFORE-triggers-that-return-NULL-can-circumvent-referential-integrity-tt6056390.html#none
>
> It's hard to say if this is the cause or not, but if you have any BEFORE triggers that RETURN NULL, you might want to
reviewthe documentation very carefully. 

We do have a BEFORE INSERT trigger, but it should never return NULL. This trigger INSERTs into a different table using
anON CONFLICT DO NOTHING clause and then does a RETURN NEW. 

Alex


pgsql-hackers by date:

Previous
From: Alex Adriaanse
Date:
Subject: Re: Corruption with duplicate primary key
Next
From: Tom Lane
Date:
Subject: Re: Runtime pruning problem