diff options
author | Tomas Vondra | 2017-06-08 16:21:46 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-06-08 16:21:46 +0000 |
commit | 42cc79c34b228da47c45c479f629c7d2035783d2 (patch) | |
tree | da7c6113b959f2a97dabc4e7c6029a566a628a92 | |
parent | 52dd75e1fe47797bcc9d66bb4192663f597b447d (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.c | 9 |
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"); |