public inbox for [email protected]  
help / color / mirror / Atom feed
From: Sami Imseih <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: pg_plan_advice: rtekind uninitialized compilation waning
Date: Thu, 12 Mar 2026 15:16:29 -0500
Message-ID: <CAA5RZ0sieVNfniCKMDdDjuXGd1OuzMQfTS5=9vX3sa-iiujKUA@mail.gmail.com> (raw)

Hi,

I just noticed $SUBJECT due to 5883ff30b0

[1/2] Compiling C object
contrib/pg_plan_advice/pg_plan_advice.so.p/pgpa_scan.c.o
In file included from ../src/include/postgres.h:49:0,
                 from ../contrib/pg_plan_advice/pgpa_scan.c:12:
../contrib/pg_plan_advice/pgpa_scan.c: In function ‘unique_nonjoin_rtekind’:
../src/include/utils/elog.h:241:18: warning: ‘rtekind’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  ereport(elevel, errmsg_internal(__VA_ARGS__))
                  ^~~~~~~~~~~~~~~
../contrib/pg_plan_advice/pgpa_scan.c:246:11: note: ‘rtekind’ was declared here
  RTEKind  rtekind;
           ^~~~~~~

Attached initializes rtekind to RTE_RELATION to keep the compiler happy.
The value is set correctly inside the loop before it's used.


--
Sami Imseih
Amazon Web Services (AWS)


Attachments:

  [application/octet-stream] v1-0001-pg_plan_advice-Fix-compilation-waning.patch (979B, 2-v1-0001-pg_plan_advice-Fix-compilation-waning.patch)
  download | inline diff:
From fa1f15f9ab6dd30cca4d767288a3420a4646701b Mon Sep 17 00:00:00 2001
From: "Sami Imseih (AWS)"
 <[email protected]>
Date: Thu, 12 Mar 2026 20:01:34 +0000
Subject: [PATCH v1 1/1] pg_plan_advice: Fix compilation waning

5883ff30b0 declared an RTEKind variable
uninitialized. Initialize it to RTE_RELATION to
suppress the compiler warning, as it will always
be set correctly in the loop before use.
---
 contrib/pg_plan_advice/pgpa_scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/pg_plan_advice/pgpa_scan.c b/contrib/pg_plan_advice/pgpa_scan.c
index 14bde3e149a..05479c535a9 100644
--- a/contrib/pg_plan_advice/pgpa_scan.c
+++ b/contrib/pg_plan_advice/pgpa_scan.c
@@ -243,7 +243,7 @@ unique_nonjoin_rtekind(Bitmapset *relids, List *rtable)
 {
 	int			rti = -1;
 	bool		first = true;
-	RTEKind		rtekind;
+	RTEKind		rtekind = RTE_RELATION; /* keep compiler happy */
 
 	Assert(relids != NULL);
 
-- 
2.47.3



view thread (4+ messages)  latest in thread

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: [email protected]
  Cc: [email protected]
  Subject: Re: pg_plan_advice: rtekind uninitialized compilation waning
  In-Reply-To: <CAA5RZ0sieVNfniCKMDdDjuXGd1OuzMQfTS5=9vX3sa-iiujKUA@mail.gmail.com>

* 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