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 <[email protected]> Reported-by: Marina Polyakova <[email protected]> Reviewed-by: Marina Polyakova <[email protected]> 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(-)
