Loop to create partitions does not work b/c a "CREATE TABLE" statement cannot be a prepared statement (laaaame).
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$$;
the above will yield a syntax error:
syntax error at or near "CREATE"
LINE 7: CREATE TABLE mbk_auth_method_$1 PARTITION OF mbk_auth_me...