0

Is it possible to merge partitions in Postgres 17?

There a a lot of blog posts on the internet suggesting that partition MERGE and SPLIT are (or will be) available in PostgreSQL 17 but there's no explicit mention of this in the release notes, nor have managed to get any of the commands to work.

I have a table that's partitioned by date range. Initially the data is split by day, then it's merged into a monthly partition.

This is the command I'm trying to run:

alter table myTable 
merge partitions (myTable_202505, myTable_20250503) 
into myTable_202505a;

And this is the error:

ERROR: syntax error at or near "merge"

Have I got the command wrong, or did the SPLIT/MERGE functionality get pulled before release?

Paul White
  • 94,921
  • 30
  • 437
  • 687
ConanTheGerbil
  • 1,303
  • 5
  • 31
  • 50

1 Answers1

2

It was decided to revert commit of this feature not long before the release. (2024-08-24)

The reason for reverting is security issues related to repeatable name lookups (CVE-2014-0062). Even though 04158e7fa3 solved part of the problem, there are still remaining issues, which aren't feasible to even carefully analyze before the RC deadline.

Some progress was made back then, but the feature was not ready and was not included in PostgreSQL 18 either.

Melkij
  • 3,912
  • 8
  • 17