Fix pg_dump getTables() queries broken by 69fba376
authorTomas Vondra <[email protected]>
Mon, 8 May 2017 01:16:22 +0000 (03:16 +0200)
committerTomas Vondra <[email protected]>
Mon, 8 May 2017 01:16:22 +0000 (03:16 +0200)
Commit 69fba376, cherry-picked from the XL9_5_STABLE branch, broke two
of the queries in getTables(). The mistake seems fairly simple - adding
the string format in one appendPQExpBuffer() call, adding the values to
the next one.

Corrected, and gcc no longer complains about format and type mismatch.

src/bin/pg_dump/pg_dump.c

index 03ed88732bad7f209de785d42bdfcf62f6616298..a527bfca5d94cb5c2a668e4caa5aae30e1f52307 100644 (file)
@@ -5329,6 +5329,11 @@ getTables(Archive *fout, int *numTables)
                                                  initacl_subquery->data,
                                                  initracl_subquery->data,
                                                  username_subquery,
+                                                 fout->isPostgresXL
+                                                         ?  "(SELECT pclocatortype from pgxc_class v where v.pcrelid = c.oid) AS pgxclocatortype,"
+                                                         "(SELECT pcattnum from pgxc_class v where v.pcrelid = c.oid) AS pgxcattnum,"
+                                                         "(SELECT string_agg(node_name,',') AS pgxc_node_names from pgxc_node n where n.oid in (select unnest(nodeoids) from pgxc_class v where v.pcrelid=c.oid) ) , "
+                                                         : "",
                                                  attacl_subquery->data,
                                                  attracl_subquery->data,
                                                  attinitacl_subquery->data,
@@ -5374,9 +5379,7 @@ getTables(Archive *fout, int *numTables)
                                                  "d.refobjsubid AS owning_col, "
                                                  "(SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, "
 #ifdef PGXC
-                                                 "(SELECT pclocatortype from pgxc_class v where v.pcrelid = c.oid) AS pgxclocatortype,"
-                                                 "(SELECT pcattnum from pgxc_class v where v.pcrelid = c.oid) AS pgxcattnum,"
-                                                 "(SELECT string_agg(node_name,',') AS pgxc_node_names from pgxc_node n where n.oid in (select unnest(nodeoids) from pgxc_class v where v.pcrelid=c.oid) ) , "
+                                                 "%s"
 #endif
                                                  "array_remove(array_remove(c.reloptions,'check_option=local'),'check_option=cascaded') AS reloptions, "
                                                  "CASE WHEN 'check_option=local' = ANY (c.reloptions) THEN 'LOCAL'::text "