Closed rkrage closed 9 months ago
I rewrote this to just always recurse because it makes the code infinitely cleaner. I still think there are some edge cases to consider, though. Like currently, we CREATE INDEX ... ON ONLY
upfront before recursing through sub-partitions, which I think is safer because it accounts for a situation where child partitions are added while the operation is running, but it also opens us up to a situation where the parent index gets created, the index name on a sub-partition is invalid due to exceeding the 63 byte limit, an error is raised and we're left with an invalid parent index.
I'm still working through these edge cases and writing tests, so this PR can be considered a draft for now.
Update: I think these concerns are resolved by https://github.com/braintree/pg_ha_migrations/pull/94
Recurse through sub-partitions when creating a partitioned index
Relies on https://github.com/braintree/pg_ha_migrations/pull/94