UPDATE column without FK fires other FK triggers constraint check

From: Luca Looz <luca(dot)looz92(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: UPDATE column without FK fires other FK triggers constraint check
Date: 2017-07-18 12:49:10
Message-ID: CAHXaXTw_2va3Dk9oT0KpEq9-t-c1MMAm0YOLhtU6ER4M31+wSw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was analyzing an update function and i have noticed "Trigger for
constraint" entries for foreign keys that i wasn't using or referring.
After some tests it seems that this happens when the same row is covered by
more than 1 update in the same transaction even without any change.

Here is a dbfiddle example:
http://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=368289a7338031b8a7b7a90f0fd25d7c

Is this an expected behavior? Why it happens?

I have initially asked this on dba stackexchange:
https://dba.stackexchange.com/questions/180012/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mikhail 2017-07-18 14:21:39 Index Only Scan and Heap Fetches
Previous Message basti 2017-07-18 09:13:47 Re: log_filename