agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: postgres_fdw: Fix "may be used uninitialized" warning in foreign
Date: Wed, 02 Sep 2026 12:50:25 +0000
Message-ID: <E1x1kQ4-00000003BAd-1GfK@gemulon.postgresql.org> (raw)

postgres_fdw: Fix "may be used uninitialized" warning in foreign_join_ok()

Commit 0ee83dd4a99 detected the mixed foreign x function-RTE cases in one
if/else chain that only set a pair of bool flags, then acted on those flags in
a second chain.  fpinfo_o and fpinfo_i are each assigned in one chain and read
in the other, so proving them initialized requires correlating the flags with
the assignments.  gcc 13 with -Og does not manage that and reports fpinfo_i as
possibly uninitialized; clang's -Wconditional-uninitialized likewise reports
both variables.

The flags served no purpose beyond deferring the work, so merge the two chains
and read both fdw_private pointers up front, unconditionally.  A function rel
never has an fdw_private of its own, so the pointer is simply NULL until the
stub replaces it, and each branch now assigns and uses the two variables in one
place.

Reported-by: Karina Litskevich <litskevichkarina@gmail.com>
Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru>
Reviewed-by: Marina Polyakova <m.polyakova@postgrespro.ru>
Discussion: https://postgr.es/m/CACiT8iamoL-%3D792e6JK2uCVvwDhfCg7DXHhvqN0P33jhGg2-8A%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0fb258d1f2ca65b7299ba7c47045634df05efbff

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 53 +++++++++++++------------------------
1 file changed, 19 insertions(+), 34 deletions(-)



Message-ID: <E1x1kQ4-00000003BAd-1GfK@gemulon.postgresql.org>
Permalink:  ../E1x1kQ4-00000003BAd-1GfK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x1kQ4-00000003BAd-1GfK@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: postgres_fdw: Fix "may be used uninitialized" warning in foreign
  In-Reply-To: <E1x1kQ4-00000003BAd-1GfK@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox