@@ -275,7 +275,7 @@ main(int argc, char **argv)
275275int compressLevel = -1 ;
276276int plainText = 0 ;
277277ArchiveFormat archiveFormat = archUnknown ;
278- ArchiveMode archiveMode ;
278+ ArchiveMode archiveMode ;
279279
280280DumpOptions * dopt = NewDumpOptions ();
281281
@@ -2156,7 +2156,8 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
21562156* collate ,
21572157* ctype ,
21582158* tablespace ;
2159- uint32 frozenxid ,minmxid ;
2159+ uint32 frozenxid ,
2160+ minmxid ;
21602161
21612162datname = PQdb (conn );
21622163
@@ -2186,7 +2187,7 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
21862187appendPQExpBuffer (dbQry ,"SELECT tableoid, oid, "
21872188"(%s datdba) AS dba, "
21882189"pg_encoding_to_char(encoding) AS encoding, "
2189- "datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
2190+ "datcollate, datctype, datfrozenxid, 0 AS datminmxid, "
21902191"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
21912192"shobj_description(oid, 'pg_database') AS description "
21922193
@@ -2200,7 +2201,7 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
22002201appendPQExpBuffer (dbQry ,"SELECT tableoid, oid, "
22012202"(%s datdba) AS dba, "
22022203"pg_encoding_to_char(encoding) AS encoding, "
2203- "NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
2204+ "NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
22042205"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, "
22052206"shobj_description(oid, 'pg_database') AS description "
22062207
@@ -2214,7 +2215,7 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
22142215appendPQExpBuffer (dbQry ,"SELECT tableoid, oid, "
22152216"(%s datdba) AS dba, "
22162217"pg_encoding_to_char(encoding) AS encoding, "
2217- "NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
2218+ "NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, "
22182219"(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace "
22192220"FROM pg_database "
22202221"WHERE datname = " ,
@@ -2338,7 +2339,8 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
23382339PGresult * lo_res ;
23392340PQExpBuffer loFrozenQry = createPQExpBuffer ();
23402341PQExpBuffer loOutQry = createPQExpBuffer ();
2341- int i_relfrozenxid ,i_relminmxid ;
2342+ int i_relfrozenxid ,
2343+ i_relminmxid ;
23422344
23432345/*
23442346 * pg_largeobject
@@ -2383,16 +2385,16 @@ dumpDatabase(Archive *fout, DumpOptions *dopt)
23832385resetPQExpBuffer (loFrozenQry );
23842386resetPQExpBuffer (loOutQry );
23852387
2386- if (fout -> remoteVersion >=90300 )
2387- appendPQExpBuffer (loFrozenQry ,"SELECT relfrozenxid, relminmxid\n"
2388- "FROM pg_catalog.pg_class\n"
2389- "WHERE oid = %u;\n" ,
2390- LargeObjectMetadataRelationId );
2391- else
2392- appendPQExpBuffer (loFrozenQry ,"SELECT relfrozenxid, 0 AS relminmxid\n"
2393- "FROM pg_catalog.pg_class\n"
2394- "WHERE oid = %u;\n" ,
2395- LargeObjectMetadataRelationId );
2388+ if (fout -> remoteVersion >=90300 )
2389+ appendPQExpBuffer (loFrozenQry ,"SELECT relfrozenxid, relminmxid\n"
2390+ "FROM pg_catalog.pg_class\n"
2391+ "WHERE oid = %u;\n" ,
2392+ LargeObjectMetadataRelationId );
2393+ else
2394+ appendPQExpBuffer (loFrozenQry ,"SELECT relfrozenxid, 0 AS relminmxid\n"
2395+ "FROM pg_catalog.pg_class\n"
2396+ "WHERE oid = %u;\n" ,
2397+ LargeObjectMetadataRelationId );
23962398
23972399lo_res = ExecuteSqlQueryForSingleRow (fout ,loFrozenQry -> data );
23982400
@@ -2747,22 +2749,24 @@ dumpBlobs(Archive *fout, DumpOptions *dopt, void *arg)
27472749
27482750/*
27492751 * getRowSecurity
2750- * get information about every row-security policy on a dumpable table.
2752+ * get information about every row-security policy on a dumpable table.
27512753 */
27522754void
27532755getRowSecurity (Archive * fout ,TableInfo tblinfo [],int numTables )
27542756{
2755- PQExpBuffer query ;
2756- PGresult * res ;
2757+ PQExpBuffer query ;
2758+ PGresult * res ;
27572759RowSecurityInfo * rsinfo ;
2758- int i_oid ;
2759- int i_tableoid ;
2760- int i_rsecpolname ;
2761- int i_rseccmd ;
2762- int i_rsecroles ;
2763- int i_rsecqual ;
2764- int i_rsecwithcheck ;
2765- int i ,j ,ntups ;
2760+ int i_oid ;
2761+ int i_tableoid ;
2762+ int i_rsecpolname ;
2763+ int i_rseccmd ;
2764+ int i_rsecroles ;
2765+ int i_rsecqual ;
2766+ int i_rsecwithcheck ;
2767+ int i ,
2768+ j ,
2769+ ntups ;
27662770
27672771if (fout -> remoteVersion < 90500 )
27682772return ;
@@ -2771,7 +2775,7 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
27712775
27722776for (i = 0 ;i < numTables ;i ++ )
27732777{
2774- TableInfo * tbinfo = & tblinfo [i ];
2778+ TableInfo * tbinfo = & tblinfo [i ];
27752779
27762780/* Ignore row-security on tables not to be dumped */
27772781if (!tbinfo -> dobj .dump )
@@ -2783,9 +2787,9 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
27832787tbinfo -> dobj .name );
27842788
27852789/*
2786- * Get row-security enabled information for the table.
2787- *We represent RLS enabled on a table by creating RowSecurityInfo
2788- *object with an empty policy.
2790+ * Get row-security enabled information for the table. We represent
2791+ * RLS enabled on a table by creating RowSecurityInfo object with an
2792+ * empty policy.
27892793 */
27902794if (tbinfo -> rowsec )
27912795{
@@ -2826,7 +2830,7 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
28262830"CASE WHEN s.rsecroles = '{0}' THEN 'PUBLIC' ELSE "
28272831" array_to_string(ARRAY(SELECT rolname from pg_roles WHERE oid = ANY(s.rsecroles)), ', ') END AS rsecroles, "
28282832"pg_get_expr(s.rsecqual, s.rsecrelid) AS rsecqual, "
2829- "pg_get_expr(s.rsecwithcheck, s.rsecrelid) AS rsecwithcheck "
2833+ "pg_get_expr(s.rsecwithcheck, s.rsecrelid) AS rsecwithcheck "
28302834"FROM pg_catalog.pg_rowsecurity s "
28312835"WHERE rsecrelid = '%u'" ,
28322836tbinfo -> dobj .catId .oid );
@@ -2894,7 +2898,7 @@ getRowSecurity(Archive *fout, TableInfo tblinfo[], int numTables)
28942898
28952899/*
28962900 * dumpRowSecurity
2897- * dump the definition of the given row-security policy
2901+ * dump the definition of the given row-security policy
28982902 */
28992903static void
29002904dumpRowSecurity (Archive * fout ,DumpOptions * dopt ,RowSecurityInfo * rsinfo )
@@ -2909,8 +2913,8 @@ dumpRowSecurity(Archive *fout, DumpOptions *dopt, RowSecurityInfo *rsinfo)
29092913
29102914/*
29112915 * If rsecpolname is NULL, then this record is just indicating that ROW
2912- * LEVEL SECURITY is enabled for the table.
2913- *Dump as ALTER TABLE <table> ENABLE ROW LEVEL SECURITY.
2916+ * LEVEL SECURITY is enabled for the table. Dump as ALTER TABLE <table>
2917+ * ENABLE ROW LEVEL SECURITY.
29142918 */
29152919if (rsinfo -> rsecpolname == NULL )
29162920{
@@ -6622,8 +6626,8 @@ getTableAttrs(Archive *fout, DumpOptions *dopt, TableInfo *tblinfo, int numTable
66226626 */
66236627if (g_verbose )
66246628write_msg (NULL ,"finding the columns and types of table \"%s\".\"%s\"\n" ,
6625- tbinfo -> dobj .namespace -> dobj .name ,
6626- tbinfo -> dobj .name );
6629+ tbinfo -> dobj .namespace -> dobj .name ,
6630+ tbinfo -> dobj .name );
66276631
66286632resetPQExpBuffer (q );
66296633
@@ -6835,8 +6839,8 @@ getTableAttrs(Archive *fout, DumpOptions *dopt, TableInfo *tblinfo, int numTable
68356839
68366840if (g_verbose )
68376841write_msg (NULL ,"finding default expressions of table \"%s\".\"%s\"\n" ,
6838- tbinfo -> dobj .namespace -> dobj .name ,
6839- tbinfo -> dobj .name );
6842+ tbinfo -> dobj .namespace -> dobj .name ,
6843+ tbinfo -> dobj .name );
68406844
68416845resetPQExpBuffer (q );
68426846if (fout -> remoteVersion >=70300 )
@@ -13772,7 +13776,7 @@ dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
1377213776 * Analogously, we set up typed tables using ALTER TABLE / OF here.
1377313777 */
1377413778if (dopt -> binary_upgrade && (tbinfo -> relkind == RELKIND_RELATION ||
13775- tbinfo -> relkind == RELKIND_FOREIGN_TABLE ))
13779+ tbinfo -> relkind == RELKIND_FOREIGN_TABLE ))
1377613780{
1377713781for (j = 0 ;j < tbinfo -> numatts ;j ++ )
1377813782{
@@ -13874,7 +13878,7 @@ dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
1387413878/* We preserve the toast oids, so we can use it during restore */
1387513879appendPQExpBufferStr (q ,"\n-- For binary upgrade, set toast's relfrozenxid and relminmxid\n" );
1387613880appendPQExpBuffer (q ,"UPDATE pg_catalog.pg_class\n"
13877- "SET relfrozenxid = '%u', relminmxid = '%u'\n"
13881+ "SET relfrozenxid = '%u', relminmxid = '%u'\n"
1387813882"WHERE oid = '%u';\n" ,
1387913883tbinfo -> toast_frozenxid ,
1388013884tbinfo -> toast_minmxid ,tbinfo -> toast_oid );