I am trying to create 500 partitions using a loop:
do $$ declare counter integer := 0; begin while counter <= 500 loop PREPARE create_table(int) AS CREATE TABLE mbk_auth_method_$1 PARTITION OF mbk_auth_method FOR VALUES WITH (modulus 500, remainder $1); EXECUTE create_table (counter); counter := counter + 1; end loop; end$$;
problem is that a CREATE TABLE cannot be prepared statement..
Anyone know how I can accomplish the above? Seems like this is a missing feature - to prepare a CREATE TABLE statement..