Partition Check not updated when insert into a partition - Mailing list pgsql-hackers

From houzj.fnst@fujitsu.com
Subject Partition Check not updated when insert into a partition
Date
Msg-id OS3PR01MB5718DA1C4609A25186D1FBF194089@OS3PR01MB5718.jpnprd01.prod.outlook.com
Whole thread Raw
Responses RE: Partition Check not updated when insert into a partition
Re: Partition Check not updated when insert into a partition
List pgsql-hackers
Hi,

When directly INSERT INTO partition, postgres will invoke ExecPartitionCheck
which will execute its parent's and grandparent's partition constraint check.
From the code, the whole constraint check is saved in relcache::rd_partcheck.

For a multi-level partition, for example: table 'A' is partition of table
'B', and 'B' is also partition of table 'C'. After I 'ALTER TABLE C DETACH B',
I thought partition constraint check of table 'C' does not matter anymore if
INSERT INTO table 'A'. But it looks like the relcache of 'A' is not invalidated
after detaching 'B'. And the relcache::rd_partcheck still include the partition
constraint of table 'C'. Note If I invalidate the table 'A''s relcache manually,
then next time the relcache::rd_partcheck will be updated to the expected
one which does not include partition constraint check of table 'C'.
(ATTACH partition has the same behaviour that relcache::rd_partcheck will
not be updated immediately)

Does it work as expected ? I didn't find some explanation from the doc.
(sorry if I missed something).

Best regards,
houzj



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Doc chapter for Hash Indexes
Next
From: Gurjeet Singh
Date:
Subject: Automatic notification for top transaction IDs