Re: Declarative partitioning - another take
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
Attachments
On 2016/12/16 17:02, Amit Langote wrote: > [PATCH 2/7] Change how RelationGetPartitionQual() and related code works > > Since we always want to recurse, ie, include the parent's partition > constraint (if any), get rid of the argument recurse. > > Refactor out the code doing the mapping of attnos of Vars in partition > constraint expressions (parent attnos -> child attnos). Move it to a > separate function map_partition_varattnos() and call it from appropriate > places. It previously used to be done in get_qual_from_partbound(), > which would lead to wrong results in certain multi-level partitioning > cases, as the mapping would be done for immediate parent-partition pairs. > Now in generate_partition_qual() which is the workhorse of > RelationGetPartitionQual(), we first generate the full expression > (considering all levels of partitioning) and then do the mapping from the > root parent to a leaf partition. It is also possible to generate > partition constraint up to certain non-leaf level and then apply the > same to leaf partitions of that sub-tree after suitable substitution > of varattnos using the new map_partition_varattnos() directly. > > Bug fix: ATExecAttachPartition() failed to do the mapping when attaching > a partitioned table as partition. It is possible for the partitions of > such table to have different attributes from the table being attached > and/or the target partitioned table. Oops, PATCH 2/7 attached with the previous email had a bug in it, whereby map_partition_varattnos() was not applied to the partition constraint expressions returned directly from the relcache (rd_partcheck) copy. Attaching just the updated (only) PATCH 2 which fixes that. Patches 1,3,4,5,6,7/7 from the previous email [1] are fine. Sorry about that. Thanks, Amit [1] https://www.postgresql.org/message-id/c820c0eb-6935-6f84-8c6a-785fdff130c1@lab.ntt.co.jp
Commits
-
Fix typo.
- 03bf59676ea0 10.0 landed
-
Document trigger-firing behavior for inheritance/partitioning.
- e17628145ac3 10.0 landed
-
Fire per-statement triggers on partitioned tables.
- e180c8aa8caf 10.0 landed
-
Set ecxt_scantuple correctly for tuple routing.
- 132488bfee68 10.0 landed
-
Fix interaction of partitioned tables with BulkInsertState.
- b1ecb9b3fcfb 10.0 landed
-
Avoid core dump for empty prepared statement in an aborted transaction.
- ba61a04bc7fe 10.0 cited
-
Fix some problems in check_new_partition_bound().
- 8a8afe2f54c2 10.0 landed
-
Remove unnecessary arguments from partitioning functions.
- 18fc5192a631 10.0 cited
-
Fix reporting of constraint violations for table partitioning.
- f1b4c771ea74 10.0 cited
-
Fix tuple routing in cases where tuple descriptors don't match.
- 2ac3ef7a01df 10.0 cited
-
Invalid parent's relcache after CREATE TABLE .. PARTITION OF.
- 7cd0fd655d68 10.0 landed
-
Doc: improve documentation about inheritance.
- 162477a63d3c 10.0 cited