cybertec-postgresql / db_migrator

Other
21 stars 8 forks source link

Support declarative partitioning #11

Closed fljdin closed 1 year ago

fljdin commented 1 year ago

Enhances API with "partitions" and "subpartitions" new tables. Add steps in materialize_foreign_table() to support partitioned tables and partitions creation when needed. See README.md for further description.

Supports LIST (with default partition), RANGE, HASH and composite partitioning. The last position of a HASH partition is read before partition creation to obtain modulus value. Positions must start at 1.

laurenz commented 1 year ago

I thought some more about partition boundaries. Perhaps they can be passed as text[]: one value for HASH, two for RANGE and arbitrarily many for LIST. Then there is the problem of numbers vs. other data types. Perhaps we can require that the values in the text[] are already properly quoted, so that we can simply use them as they are.

laurenz commented 1 year ago

Ok, I think I have tortured you enough with my complaints, and thanks for your patience. I will take it from here and get this merged.

fljdin commented 1 year ago

Good news! All of your suggestions sounded good to me, thanks for your feedback!

laurenz commented 1 year ago

Thanks again.