Hi, Commit 6f6b99d1335be8ea1b74581fc489a97b109dd08a introduced default partitioning support. This commit added a new function check_default_allows_bound(), which checks if there exists a row in the default partition that would belong to the new partition being added. If it finds one, it throws an error. Before taking the decision to scan the default partition, this function checks if there are existing constraints on default partition that would imply the new partition constraints, if yes it skips scanning the default partition, otherwise it scans the default partition and its children(if any). But, while doing so the current code misses the fact that there can be constraints on the child of default partition such that they would imply the constraints of the new partition being added, and hence individual child scan can also be skipped. Attached is the patch which does this.
This is previously discussed in default partitioning thread[1], and decision was made that we can take this a separate patch rather than as a part of the default partitioning support. Amit Langote has a similar patch[2] for scanning the children of a partitioned table which is being attached as partition of another partitioned table. [1] https://www.postgresql.org/message-id/CA+TgmoZ8-q=2oahoxmvzbdnxi9g6i1idi4ozfkb67mk242d...@mail.gmail.com [2] https://www.postgresql.org/message-id/4cd13b03-846d-dc65-89de-1fd9743a3...@lab.ntt.co.jp Regards, Jeevan Ladhe
0001-Check-default-partitition-child-validation-scan-is.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers