summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2017-06-08 16:21:46 +0000
committerTomas Vondra2017-06-08 16:21:46 +0000
commit42cc79c34b228da47c45c479f629c7d2035783d2 (patch)
treeda7c6113b959f2a97dabc4e7c6029a566a628a92
parent52dd75e1fe47797bcc9d66bb4192663f597b447d (diff)
Fix warnings about uninitialized vars in pg_dump.c
Three XL-specific fields in getTables() were initialized and used in two independent if blocks looking like this: if (fout->isPostgresXL) { i_pgxclocatortype = PQfnumber(res, "pgxclocatortype"); i_pgxcattnum = PQfnumber(res, "pgxcattnum"); i_pgxc_node_names = PQfnumber(res, "pgxc_node_names"); } if (fout->isPostgresXL) { ... use the variables ... } Which however confuses the compiler (gcc 5.3.1) which then complains that the variables are maybe used uninitialized. The fix is simple, just make the initialization unconditional - if there are no such columns then PQfnumber() will return -1, but we'll not use the value anyway.
-rw-r--r--src/bin/pg_dump/pg_dump.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index a527bfca5d..1d237e3056 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -5930,12 +5930,9 @@ getTables(Archive *fout, int *numTables)
i_owning_tab = PQfnumber(res, "owning_tab");
i_owning_col = PQfnumber(res, "owning_col");
#ifdef PGXC
- if (fout->isPostgresXL)
- {
- i_pgxclocatortype = PQfnumber(res, "pgxclocatortype");
- i_pgxcattnum = PQfnumber(res, "pgxcattnum");
- i_pgxc_node_names = PQfnumber(res, "pgxc_node_names");
- }
+ i_pgxclocatortype = PQfnumber(res, "pgxclocatortype");
+ i_pgxcattnum = PQfnumber(res, "pgxcattnum");
+ i_pgxc_node_names = PQfnumber(res, "pgxc_node_names");
#endif
i_reltablespace = PQfnumber(res, "reltablespace");
i_reloptions = PQfnumber(res, "reloptions");