Saturday, July 08, 2017

ALTERing the Bounds of a Partition

DZone Database Zone
ALTERing the Bounds of a Partition

PostgreSQL 10 is full with a lot of big, new, and exciting features. Declarative partitioning is one of those. It is something users have wanted for years. During PGCon 2017, it was a hot topic of discussion. People wanted to know more about the feature and were eager to try it out. The conference session on partitioning attracted a large crowd. One of the frequently asked questions centered on whether a user can change partition bounds of an existing partition. This bears exploring, and an answer. 

Implicit in the question is the use of the ALTER TABLE command. For those who are new to PostgreSQL or to PostgreSQL partitioning, partitions are tables in PostgreSQL. Database administrators use the CREATE TABLE command to create partitions using the PARTITION OF clause. Essentially, users then expect an ALTER TABLE subcommand that allows a change to the partition bounds, for example, ALTER TABLE... ALTER FOR VALUES ... or a similar kind of command. But there's no such ALTER TABLE subcommand in PostgreSQL v10. We may add it in the future versions, but we have not seen any such proposal yet.

No comments:

Fun With SQL: Functions in Postgres

DZone Database Zone Fun With SQL: Functions in Postgres In our previous  Fun with SQL  post on the  Citus Data  blog, we covered w...