I am creating a table which would have 512 partitions in PostgreSQL 12. The table will be partitioned using hashing.
How can I create the 512 partitions without having to create each one manually?
Would creating a loop using pl/pgsql would be the best route?
create table dept_1 partition of dept FOR VALUES WITH (MODULUS 512, REMAINDER 0);
create table dept_2 partition of dept FOR VALUES WITH (MODULUS 512, REMAINDER 1);
create table dept_3 partition of dept FOR VALUES WITH (MODULUS 512, REMAINDER 2);
......
create table dept_512 partition of dept FOR VALUES WITH (MODULUS 512, REMAINDER 511);