Suppress uninitialized-variable warning.
authorTom Lane <[email protected]>
Tue, 29 Jul 2025 13:42:22 +0000 (09:42 -0400)
committerTom Lane <[email protected]>
Tue, 29 Jul 2025 13:42:22 +0000 (09:42 -0400)
In the wake of commit 80aa9848b, a few compilers think that
postgresAcquireSampleRowsFunc's "reltuples" might be used
uninitialized.  The logic is visibly correct, both before
and after that change; presumably what happened here is that
the previous presence of a setjmp() in the function stopped
them from attempting any flow analysis at all.  Add a dummy
initialization to silence the warning.

Reported-by: Ashutosh Bapat <[email protected]>
Author: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAExHW5tkerCufA_F6oct5dMJ61N+yVrVgYXL7M8dD-5_zXjrDw@mail.gmail.com

contrib/postgres_fdw/postgres_fdw.c

index 25b287be069fa70a8b6f41296b8db682dcf13389..9d266b3e2b1205aae507427782c79f200fa84ea1 100644 (file)
@@ -5018,7 +5018,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
        int                     server_version_num;
        PgFdwSamplingMethod method = ANALYZE_SAMPLE_AUTO;       /* auto is default */
        double          sample_frac = -1.0;
-       double          reltuples;
+       double          reltuples = -1.0;
        unsigned int cursor_number;
        StringInfoData sql;
        PGresult   *res;