mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
pg_dump: Refactor dumpDatabase()
Rearrange the version-dependent pieces in the new more modular style.
This commit is contained in:
parent
dfe67c0e85
commit
56a3e848c7
@ -2779,34 +2779,21 @@ dumpDatabase(Archive *fout)
|
|||||||
/*
|
/*
|
||||||
* Fetch the database-level properties for this database.
|
* Fetch the database-level properties for this database.
|
||||||
*/
|
*/
|
||||||
|
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, datname, "
|
||||||
|
"datdba, "
|
||||||
|
"pg_encoding_to_char(encoding) AS encoding, "
|
||||||
|
"datcollate, datctype, datfrozenxid, "
|
||||||
|
"datacl, acldefault('d', datdba) AS acldefault, "
|
||||||
|
"datistemplate, datconnlimit, ");
|
||||||
if (fout->remoteVersion >= 90300)
|
if (fout->remoteVersion >= 90300)
|
||||||
{
|
appendPQExpBuffer(dbQry, "datminmxid, ");
|
||||||
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, datname, "
|
|
||||||
"datdba, "
|
|
||||||
"pg_encoding_to_char(encoding) AS encoding, "
|
|
||||||
"datcollate, datctype, datfrozenxid, datminmxid, "
|
|
||||||
"datacl, acldefault('d', datdba) AS acldefault, "
|
|
||||||
"datistemplate, datconnlimit, "
|
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
|
||||||
"shobj_description(oid, 'pg_database') AS description "
|
|
||||||
|
|
||||||
"FROM pg_database "
|
|
||||||
"WHERE datname = current_database()");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
appendPQExpBuffer(dbQry, "0 AS datminmxid, ");
|
||||||
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, datname, "
|
appendPQExpBuffer(dbQry,
|
||||||
"datdba, "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
||||||
"pg_encoding_to_char(encoding) AS encoding, "
|
"shobj_description(oid, 'pg_database') AS description "
|
||||||
"datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
|
"FROM pg_database "
|
||||||
"datacl, acldefault('d', datdba) AS acldefault, "
|
"WHERE datname = current_database()");
|
||||||
"datistemplate, datconnlimit, "
|
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
|
||||||
"shobj_description(oid, 'pg_database') AS description "
|
|
||||||
|
|
||||||
"FROM pg_database "
|
|
||||||
"WHERE datname = current_database()");
|
|
||||||
}
|
|
||||||
|
|
||||||
res = ExecuteSqlQueryForSingleRow(fout, dbQry->data);
|
res = ExecuteSqlQueryForSingleRow(fout, dbQry->data);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user