Fix warnings about uninitialized vars in pg_dump.c
authorTomas Vondra <[email protected]>
Thu, 8 Jun 2017 16:21:46 +0000 (18:21 +0200)
committerTomas Vondra <[email protected]>
Thu, 8 Jun 2017 16:21:46 +0000 (18:21 +0200)
commit42cc79c34b228da47c45c479f629c7d2035783d2
treeda7c6113b959f2a97dabc4e7c6029a566a628a92
parent52dd75e1fe47797bcc9d66bb4192663f597b447d
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.
src/bin/pg_dump/pg_dump.c