mirror of
https://github.com/postgres/postgres.git
synced 2025-06-20 15:22:23 +03:00
Re-pgindent src/bin/pg_dump/*.
Seems to have gotten rather messy lately, as a consequence of a couple of large recent commits.
This commit is contained in:
@ -1331,7 +1331,8 @@ readMessageFromPipe(int fd)
|
|||||||
static int
|
static int
|
||||||
pgpipe(int handles[2])
|
pgpipe(int handles[2])
|
||||||
{
|
{
|
||||||
pgsocket s, tmp_sock;
|
pgsocket s,
|
||||||
|
tmp_sock;
|
||||||
struct sockaddr_in serv_addr;
|
struct sockaddr_in serv_addr;
|
||||||
int len = sizeof(serv_addr);
|
int len = sizeof(serv_addr);
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ typedef enum
|
|||||||
/* Arguments needed for a worker process */
|
/* Arguments needed for a worker process */
|
||||||
typedef struct ParallelArgs
|
typedef struct ParallelArgs
|
||||||
{
|
{
|
||||||
ArchiveHandle *AH;
|
ArchiveHandle *AH;
|
||||||
TocEntry *te;
|
TocEntry *te;
|
||||||
} ParallelArgs;
|
} ParallelArgs;
|
||||||
|
|
||||||
/* State for each parallel activity slot */
|
/* State for each parallel activity slot */
|
||||||
|
@ -4241,7 +4241,7 @@ identify_locking_dependencies(ArchiveHandle *AH, TocEntry *te)
|
|||||||
|
|
||||||
if (depid <= AH->maxDumpId && AH->tocsByDumpId[depid] != NULL &&
|
if (depid <= AH->maxDumpId && AH->tocsByDumpId[depid] != NULL &&
|
||||||
((strcmp(AH->tocsByDumpId[depid]->desc, "TABLE DATA") == 0) ||
|
((strcmp(AH->tocsByDumpId[depid]->desc, "TABLE DATA") == 0) ||
|
||||||
strcmp(AH->tocsByDumpId[depid]->desc, "TABLE") == 0))
|
strcmp(AH->tocsByDumpId[depid]->desc, "TABLE") == 0))
|
||||||
lockids[nlockids++] = depid;
|
lockids[nlockids++] = depid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ EndDBCopyMode(Archive *AHX, const char *tocEntryTag)
|
|||||||
res = PQgetResult(AH->connection);
|
res = PQgetResult(AH->connection);
|
||||||
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
warn_or_exit_horribly(AH, modulename, "COPY failed for table \"%s\": %s",
|
warn_or_exit_horribly(AH, modulename, "COPY failed for table \"%s\": %s",
|
||||||
tocEntryTag, PQerrorMessage(AH->connection));
|
tocEntryTag, PQerrorMessage(AH->connection));
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|
||||||
AH->pgCopyIn = false;
|
AH->pgCopyIn = false;
|
||||||
|
@ -275,7 +275,7 @@ main(int argc, char **argv)
|
|||||||
int compressLevel = -1;
|
int compressLevel = -1;
|
||||||
int plainText = 0;
|
int plainText = 0;
|
||||||
ArchiveFormat archiveFormat = archUnknown;
|
ArchiveFormat archiveFormat = archUnknown;
|
||||||
ArchiveMode archiveMode;
|
ArchiveMode archiveMode;
|
||||||
|
|
||||||
DumpOptions *dopt = NewDumpOptions();
|
DumpOptions *dopt = NewDumpOptions();
|
||||||
|
|
||||||
@ -2156,7 +2156,8 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
|
|||||||
*collate,
|
*collate,
|
||||||
*ctype,
|
*ctype,
|
||||||
*tablespace;
|
*tablespace;
|
||||||
uint32 frozenxid, minmxid;
|
uint32 frozenxid,
|
||||||
|
minmxid;
|
||||||
|
|
||||||
datname = PQdb(conn);
|
datname = PQdb(conn);
|
||||||
|
|
||||||
@ -2186,7 +2187,7 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
|
|||||||
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
|
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
|
||||||
"(%s datdba) AS dba, "
|
"(%s datdba) AS dba, "
|
||||||
"pg_encoding_to_char(encoding) AS encoding, "
|
"pg_encoding_to_char(encoding) AS encoding, "
|
||||||
"datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
|
"datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
||||||
"shobj_description(oid, 'pg_database') AS description "
|
"shobj_description(oid, 'pg_database') AS description "
|
||||||
|
|
||||||
@ -2200,7 +2201,7 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
|
|||||||
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
|
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
|
||||||
"(%s datdba) AS dba, "
|
"(%s datdba) AS dba, "
|
||||||
"pg_encoding_to_char(encoding) AS encoding, "
|
"pg_encoding_to_char(encoding) AS encoding, "
|
||||||
"NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
|
"NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
|
||||||
"shobj_description(oid, 'pg_database') AS description "
|
"shobj_description(oid, 'pg_database') AS description "
|
||||||
|
|
||||||
@ -2214,7 +2215,7 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
|
|||||||
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
|
appendPQExpBuffer(dbQry, "SELECT tableoid, oid, "
|
||||||
"(%s datdba) AS dba, "
|
"(%s datdba) AS dba, "
|
||||||
"pg_encoding_to_char(encoding) AS encoding, "
|
"pg_encoding_to_char(encoding) AS encoding, "
|
||||||
"NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
|
"NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace "
|
||||||
"FROM pg_database "
|
"FROM pg_database "
|
||||||
"WHERE datname = ",
|
"WHERE datname = ",
|
||||||
@ -2338,7 +2339,8 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
|
|||||||
PGresult *lo_res;
|
PGresult *lo_res;
|
||||||
PQExpBuffer loFrozenQry = createPQExpBuffer();
|
PQExpBuffer loFrozenQry = createPQExpBuffer();
|
||||||
PQExpBuffer loOutQry = createPQExpBuffer();
|
PQExpBuffer loOutQry = createPQExpBuffer();
|
||||||
int i_relfrozenxid, i_relminmxid;
|
int i_relfrozenxid,
|
||||||
|
i_relminmxid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pg_largeobject
|
* pg_largeobject
|
||||||
@ -2383,16 +2385,16 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
|
|||||||
resetPQExpBuffer(loFrozenQry);
|
resetPQExpBuffer(loFrozenQry);
|
||||||
resetPQExpBuffer(loOutQry);
|
resetPQExpBuffer(loOutQry);
|
||||||
|
|
||||||
if (fout->remoteVersion >= 90300)
|
if (fout->remoteVersion >= 90300)
|
||||||
appendPQExpBuffer(loFrozenQry, "SELECT relfrozenxid, relminmxid\n"
|
appendPQExpBuffer(loFrozenQry, "SELECT relfrozenxid, relminmxid\n"
|
||||||
"FROM pg_catalog.pg_class\n"
|
"FROM pg_catalog.pg_class\n"
|
||||||
"WHERE oid = %u;\n",
|
"WHERE oid = %u;\n",
|
||||||
LargeObjectMetadataRelationId);
|
LargeObjectMetadataRelationId);
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(loFrozenQry, "SELECT relfrozenxid, 0 AS relminmxid\n"
|
appendPQExpBuffer(loFrozenQry, "SELECT relfrozenxid, 0 AS relminmxid\n"
|
||||||
"FROM pg_catalog.pg_class\n"
|
"FROM pg_catalog.pg_class\n"
|
||||||
"WHERE oid = %u;\n",
|
"WHERE oid = %u;\n",
|
||||||
LargeObjectMetadataRelationId);
|
LargeObjectMetadataRelationId);
|
||||||
|
|
||||||
lo_res = ExecuteSqlQueryForSingleRow(fout, loFrozenQry->data);
|
lo_res = ExecuteSqlQueryForSingleRow(fout, loFrozenQry->data);
|
||||||
|
|
||||||
@ -2747,22 +2749,24 @@ dumpBlobs(Archive *fout, DumpOptions *dopt, void *arg)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* getRowSecurity
|
* getRowSecurity
|
||||||
* get information about every row-security policy on a dumpable table.
|
* get information about every row-security policy on a dumpable table.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
|
getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
|
||||||
{
|
{
|
||||||
PQExpBuffer query;
|
PQExpBuffer query;
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
RowSecurityInfo *rsinfo;
|
RowSecurityInfo *rsinfo;
|
||||||
int i_oid;
|
int i_oid;
|
||||||
int i_tableoid;
|
int i_tableoid;
|
||||||
int i_rsecpolname;
|
int i_rsecpolname;
|
||||||
int i_rseccmd;
|
int i_rseccmd;
|
||||||
int i_rsecroles;
|
int i_rsecroles;
|
||||||
int i_rsecqual;
|
int i_rsecqual;
|
||||||
int i_rsecwithcheck;
|
int i_rsecwithcheck;
|
||||||
int i, j, ntups;
|
int i,
|
||||||
|
j,
|
||||||
|
ntups;
|
||||||
|
|
||||||
if (fout->remoteVersion < 90500)
|
if (fout->remoteVersion < 90500)
|
||||||
return;
|
return;
|
||||||
@ -2771,7 +2775,7 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
|
|
||||||
for (i = 0; i < numTables; i++)
|
for (i = 0; i < numTables; i++)
|
||||||
{
|
{
|
||||||
TableInfo *tbinfo = &tblinfo[i];
|
TableInfo *tbinfo = &tblinfo[i];
|
||||||
|
|
||||||
/* Ignore row-security on tables not to be dumped */
|
/* Ignore row-security on tables not to be dumped */
|
||||||
if (!tbinfo->dobj.dump)
|
if (!tbinfo->dobj.dump)
|
||||||
@ -2783,9 +2787,9 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
tbinfo->dobj.name);
|
tbinfo->dobj.name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get row-security enabled information for the table.
|
* Get row-security enabled information for the table. We represent
|
||||||
* We represent RLS enabled on a table by creating RowSecurityInfo
|
* RLS enabled on a table by creating RowSecurityInfo object with an
|
||||||
* object with an empty policy.
|
* empty policy.
|
||||||
*/
|
*/
|
||||||
if (tbinfo->rowsec)
|
if (tbinfo->rowsec)
|
||||||
{
|
{
|
||||||
@ -2826,7 +2830,7 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
"CASE WHEN s.rsecroles = '{0}' THEN 'PUBLIC' ELSE "
|
"CASE WHEN s.rsecroles = '{0}' THEN 'PUBLIC' ELSE "
|
||||||
" array_to_string(ARRAY(SELECT rolname from pg_roles WHERE oid = ANY(s.rsecroles)), ', ') END AS rsecroles, "
|
" array_to_string(ARRAY(SELECT rolname from pg_roles WHERE oid = ANY(s.rsecroles)), ', ') END AS rsecroles, "
|
||||||
"pg_get_expr(s.rsecqual, s.rsecrelid) AS rsecqual, "
|
"pg_get_expr(s.rsecqual, s.rsecrelid) AS rsecqual, "
|
||||||
"pg_get_expr(s.rsecwithcheck, s.rsecrelid) AS rsecwithcheck "
|
"pg_get_expr(s.rsecwithcheck, s.rsecrelid) AS rsecwithcheck "
|
||||||
"FROM pg_catalog.pg_rowsecurity s "
|
"FROM pg_catalog.pg_rowsecurity s "
|
||||||
"WHERE rsecrelid = '%u'",
|
"WHERE rsecrelid = '%u'",
|
||||||
tbinfo->dobj.catId.oid);
|
tbinfo->dobj.catId.oid);
|
||||||
@ -2894,7 +2898,7 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* dumpRowSecurity
|
* dumpRowSecurity
|
||||||
* dump the definition of the given row-security policy
|
* dump the definition of the given row-security policy
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dumpRowSecurity(Archive *fout, DumpOptions *dopt, RowSecurityInfo *rsinfo)
|
dumpRowSecurity(Archive *fout, DumpOptions *dopt, RowSecurityInfo *rsinfo)
|
||||||
@ -2909,8 +2913,8 @@ dumpRowSecurity(Archive *fout, DumpOptions *dopt, RowSecurityInfo *rsinfo)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If rsecpolname is NULL, then this record is just indicating that ROW
|
* If rsecpolname is NULL, then this record is just indicating that ROW
|
||||||
* LEVEL SECURITY is enabled for the table.
|
* LEVEL SECURITY is enabled for the table. Dump as ALTER TABLE <table>
|
||||||
* Dump as ALTER TABLE <table> ENABLE ROW LEVEL SECURITY.
|
* ENABLE ROW LEVEL SECURITY.
|
||||||
*/
|
*/
|
||||||
if (rsinfo->rsecpolname == NULL)
|
if (rsinfo->rsecpolname == NULL)
|
||||||
{
|
{
|
||||||
@ -6622,8 +6626,8 @@ getTableAttrs(Archive *fout, DumpOptions *dopt, TableInfo *tblinfo, int numTable
|
|||||||
*/
|
*/
|
||||||
if (g_verbose)
|
if (g_verbose)
|
||||||
write_msg(NULL, "finding the columns and types of table \"%s\".\"%s\"\n",
|
write_msg(NULL, "finding the columns and types of table \"%s\".\"%s\"\n",
|
||||||
tbinfo->dobj.namespace->dobj.name,
|
tbinfo->dobj.namespace->dobj.name,
|
||||||
tbinfo->dobj.name);
|
tbinfo->dobj.name);
|
||||||
|
|
||||||
resetPQExpBuffer(q);
|
resetPQExpBuffer(q);
|
||||||
|
|
||||||
@ -6835,8 +6839,8 @@ getTableAttrs(Archive *fout, DumpOptions *dopt, TableInfo *tblinfo, int numTable
|
|||||||
|
|
||||||
if (g_verbose)
|
if (g_verbose)
|
||||||
write_msg(NULL, "finding default expressions of table \"%s\".\"%s\"\n",
|
write_msg(NULL, "finding default expressions of table \"%s\".\"%s\"\n",
|
||||||
tbinfo->dobj.namespace->dobj.name,
|
tbinfo->dobj.namespace->dobj.name,
|
||||||
tbinfo->dobj.name);
|
tbinfo->dobj.name);
|
||||||
|
|
||||||
resetPQExpBuffer(q);
|
resetPQExpBuffer(q);
|
||||||
if (fout->remoteVersion >= 70300)
|
if (fout->remoteVersion >= 70300)
|
||||||
@ -13772,7 +13776,7 @@ dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
|
|||||||
* Analogously, we set up typed tables using ALTER TABLE / OF here.
|
* Analogously, we set up typed tables using ALTER TABLE / OF here.
|
||||||
*/
|
*/
|
||||||
if (dopt->binary_upgrade && (tbinfo->relkind == RELKIND_RELATION ||
|
if (dopt->binary_upgrade && (tbinfo->relkind == RELKIND_RELATION ||
|
||||||
tbinfo->relkind == RELKIND_FOREIGN_TABLE))
|
tbinfo->relkind == RELKIND_FOREIGN_TABLE))
|
||||||
{
|
{
|
||||||
for (j = 0; j < tbinfo->numatts; j++)
|
for (j = 0; j < tbinfo->numatts; j++)
|
||||||
{
|
{
|
||||||
@ -13874,7 +13878,7 @@ dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
|
|||||||
/* We preserve the toast oids, so we can use it during restore */
|
/* We preserve the toast oids, so we can use it during restore */
|
||||||
appendPQExpBufferStr(q, "\n-- For binary upgrade, set toast's relfrozenxid and relminmxid\n");
|
appendPQExpBufferStr(q, "\n-- For binary upgrade, set toast's relfrozenxid and relminmxid\n");
|
||||||
appendPQExpBuffer(q, "UPDATE pg_catalog.pg_class\n"
|
appendPQExpBuffer(q, "UPDATE pg_catalog.pg_class\n"
|
||||||
"SET relfrozenxid = '%u', relminmxid = '%u'\n"
|
"SET relfrozenxid = '%u', relminmxid = '%u'\n"
|
||||||
"WHERE oid = '%u';\n",
|
"WHERE oid = '%u';\n",
|
||||||
tbinfo->toast_frozenxid,
|
tbinfo->toast_frozenxid,
|
||||||
tbinfo->toast_minmxid, tbinfo->toast_oid);
|
tbinfo->toast_minmxid, tbinfo->toast_oid);
|
||||||
|
@ -460,13 +460,13 @@ typedef struct _blobInfo
|
|||||||
*/
|
*/
|
||||||
typedef struct _rowSecurityInfo
|
typedef struct _rowSecurityInfo
|
||||||
{
|
{
|
||||||
DumpableObject dobj;
|
DumpableObject dobj;
|
||||||
TableInfo *rstable;
|
TableInfo *rstable;
|
||||||
char *rsecpolname; /* null indicates RLS is enabled on rel */
|
char *rsecpolname; /* null indicates RLS is enabled on rel */
|
||||||
char *rseccmd;
|
char *rseccmd;
|
||||||
char *rsecroles;
|
char *rsecroles;
|
||||||
char *rsecqual;
|
char *rsecqual;
|
||||||
char *rsecwithcheck;
|
char *rsecwithcheck;
|
||||||
} RowSecurityInfo;
|
} RowSecurityInfo;
|
||||||
|
|
||||||
/* global decls */
|
/* global decls */
|
||||||
|
@ -57,7 +57,7 @@ static void buildShSecLabels(PGconn *conn, const char *catalog_name,
|
|||||||
uint32 objectId, PQExpBuffer buffer,
|
uint32 objectId, PQExpBuffer buffer,
|
||||||
const char *target, const char *objname);
|
const char *target, const char *objname);
|
||||||
static PGconn *connectDatabase(const char *dbname, const char *connstr, const char *pghost, const char *pgport,
|
static PGconn *connectDatabase(const char *dbname, const char *connstr, const char *pghost, const char *pgport,
|
||||||
const char *pguser, trivalue prompt_password, bool fail_on_error);
|
const char *pguser, trivalue prompt_password, bool fail_on_error);
|
||||||
static char *constructConnStr(const char **keywords, const char **values);
|
static char *constructConnStr(const char **keywords, const char **values);
|
||||||
static PGresult *executeQuery(PGconn *conn, const char *query);
|
static PGresult *executeQuery(PGconn *conn, const char *query);
|
||||||
static void executeCommand(PGconn *conn, const char *query);
|
static void executeCommand(PGconn *conn, const char *query);
|
||||||
@ -1277,7 +1277,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"SELECT datname, "
|
"SELECT datname, "
|
||||||
"coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), "
|
"coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), "
|
||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
|
"datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"datistemplate, datacl, datconnlimit, "
|
"datistemplate, datacl, datconnlimit, "
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "
|
||||||
"FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) "
|
"FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) "
|
||||||
@ -1287,7 +1287,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"SELECT datname, "
|
"SELECT datname, "
|
||||||
"coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), "
|
"coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), "
|
||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, "
|
"null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"datistemplate, datacl, datconnlimit, "
|
"datistemplate, datacl, datconnlimit, "
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "
|
||||||
"FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) "
|
"FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) "
|
||||||
@ -1297,7 +1297,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"SELECT datname, "
|
"SELECT datname, "
|
||||||
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, "
|
"null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"datistemplate, datacl, -1 as datconnlimit, "
|
"datistemplate, datacl, -1 as datconnlimit, "
|
||||||
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "
|
"(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace "
|
||||||
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
|
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
|
||||||
@ -1307,7 +1307,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
"SELECT datname, "
|
"SELECT datname, "
|
||||||
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
"coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), "
|
||||||
"pg_encoding_to_char(d.encoding), "
|
"pg_encoding_to_char(d.encoding), "
|
||||||
"null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, "
|
"null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, "
|
||||||
"datistemplate, datacl, -1 as datconnlimit, "
|
"datistemplate, datacl, -1 as datconnlimit, "
|
||||||
"'pg_default' AS dattablespace "
|
"'pg_default' AS dattablespace "
|
||||||
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
|
"FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) "
|
||||||
@ -1419,7 +1419,7 @@ dumpCreateDB(PGconn *conn)
|
|||||||
{
|
{
|
||||||
appendPQExpBufferStr(buf, "-- For binary upgrade, set datfrozenxid and datminmxid.\n");
|
appendPQExpBufferStr(buf, "-- For binary upgrade, set datfrozenxid and datminmxid.\n");
|
||||||
appendPQExpBuffer(buf, "UPDATE pg_catalog.pg_database "
|
appendPQExpBuffer(buf, "UPDATE pg_catalog.pg_database "
|
||||||
"SET datfrozenxid = '%u', datminmxid = '%u' "
|
"SET datfrozenxid = '%u', datminmxid = '%u' "
|
||||||
"WHERE datname = ",
|
"WHERE datname = ",
|
||||||
dbfrozenxid, dbminmxid);
|
dbfrozenxid, dbminmxid);
|
||||||
appendStringLiteralConn(buf, dbname, conn);
|
appendStringLiteralConn(buf, dbname, conn);
|
||||||
|
Reference in New Issue
Block a user