Hello!
I found a few problematic corner cases while testing the patches,
please look at the following:
Doesn't pg_get_database_ddl need more filtering for roles?
See example:
CREATE DATABASE testdb;
CREATE ROLE testrole;
ALTER DATABASE testdb SET work_mem TO '256MB';
ALTER ROLE testrole IN DATABASE testdb SET work_mem TO '512MB';
SELECT pg_get_database_ddl('testdb');
Another issue is that the data style isn't fixed:
CREATE ROLE regress_datestyle_test VALID UNTIL '2030-12-31 23:59:59+00';
SET DateStyle TO 'SQL, DMY';
SELECT * FROM pg_get_role_ddl('regress_datestyle_test');
-- returned statement fails with invalid input syntax for timestamp
+ appendStringInfo(&buf, "ALTER DATABASE %s OWNER = %s;",
+ dbname, quote_identifier(owner));
Shouldn't that be OWNER TO? Similarly this will result in an error
when executed.
Role memberships seem to be missing. I would expect those to be included?
CREATE ROLE regress_parent;
CREATE ROLE regress_child;
GRANT regress_parent TO regress_child;
SELECT * FROM pg_get_role_ddl('regress_child');
+ dbname = quote_identifier(NameStr(dbform->datname));
Isn't an pstrdup missing from here? dbname is used after ReleaseSysCache.