Skip to content

Zero partition helper

Simon Tomlinson requested to merge zero-partition-helper into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Helper for list-partitioning an existing table and attaching it as the first partition of a new table.

This helper performs the following actions:

  • verifies that the table is partitionable (a check constraint already supports the partitioning, and all unique are compatible
  • creates a new parent table to attach the current table to
  • Adds foreign keys to the new parent table, taking care to lock only one other table per transaction
  • Attaches the table as a first partition of the parent
  • Re-owns sequences so that they belong to the parent
  • Drops the check constraint that supported the partitioning, as it is now redundant.

The entire process is designed to take as few locks as possible per-transaction, and to be rerunnable if a failure occurs at any point.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Grzegorz Bizon

Merge request reports