Re: Fix foreign key constraint check for partitioned tables - Mailing list pgsql-hackers

From Hadi Moshayedi
Subject Re: Fix foreign key constraint check for partitioned tables
Date
Msg-id CAK=1=WonwcuN_0KiZwQO3SQxse41jZ5hOJRpFCvZ3qa8n9cssw@mail.gmail.com
Whole thread Raw
In response to Re: Fix foreign key constraint check for partitioned tables  (Edmund Horner <ejrh00@gmail.com>)
Responses Re: Fix foreign key constraint check for partitioned tables
List pgsql-hackers
Hello Edmund,

Thanks for the review.
 
I was a bit curious about the need for "set role" in the reproduction,
but I see that it's because RI_Initial_Check does some checks to see
if a simple SELECT can be used, and one of the checks is for basic
table permissions.

I think to reproduce this the current user shouldn't be able to SELECT on both tables, so RI_Initial_Check fails. Setting the owner of one of the tables isn't always enough as the current user can be a super user.
  
I wonder if the macro RELKIND_HAS_STORAGE should be used instead of
checking for each relkind?  This would apply to the check on line 4405
too.

done.

This patch also changed the output of some of tests, i.e. previously foreign key constraint failures errored on the partitioned table itself, but now it shows the child table's name in the error message. I hope it is ok.

I also added a regression test which would fail without this patch.

Thanks,
Hadi
 
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: warning to publication created and wal_level is not set to logical
Next
From: Erik Rijkers
Date:
Subject: Re: [HACKERS] proposal: schema variables