Hi Jeevan, On 2017/09/12 18:22, Jeevan Ladhe wrote: > 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.
Patch looks fine to me. By the way, why don't we just say "Can we skip scanning part_rel?" in the comment before the newly added call to PartConstraintImpliedByRelConstraint()? We don't need to repeat the explanation of what it does at the every place we call it. > 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. I just posted my rebased patch there [1]. Thanks, Amit [1] https://www.postgresql.org/message-id/a83a0899-19f5-594c-9aac-3ba0f16989a1%40lab.ntt.co.jp -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers