public inbox for [email protected]  
help / color / mirror / Atom feed
pg_plan_advice: rtekind uninitialized compilation waning
4+ messages / 3 participants
[nested] [flat]

* pg_plan_advice: rtekind uninitialized compilation waning
@ 2026-03-12 20:16 Sami Imseih <[email protected]>
  2026-03-12 21:20 ` Re: pg_plan_advice: rtekind uninitialized compilation waning Nathan Bossart <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Sami Imseih @ 2026-03-12 20:16 UTC (permalink / raw)
  To: pgsql-hackers

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_plan_advice: rtekind uninitialized compilation waning
  2026-03-12 20:16 pg_plan_advice: rtekind uninitialized compilation waning Sami Imseih <[email protected]>
@ 2026-03-12 21:20 ` Nathan Bossart <[email protected]>
  2026-03-13 16:32   ` Re: pg_plan_advice: rtekind uninitialized compilation waning Nathan Bossart <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Nathan Bossart @ 2026-03-12 21:20 UTC (permalink / raw)
  To: Sami Imseih <[email protected]>; +Cc: pgsql-hackers; [email protected]

I've added Robert.

On Thu, Mar 12, 2026 at 03:16:29PM -0500, Sami Imseih wrote:
> Attached initializes rtekind to RTE_RELATION to keep the compiler happy.
> The value is set correctly inside the loop before it's used.

Looks correct to me.

-- 
nathan





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_plan_advice: rtekind uninitialized compilation waning
  2026-03-12 20:16 pg_plan_advice: rtekind uninitialized compilation waning Sami Imseih <[email protected]>
  2026-03-12 21:20 ` Re: pg_plan_advice: rtekind uninitialized compilation waning Nathan Bossart <[email protected]>
@ 2026-03-13 16:32   ` Nathan Bossart <[email protected]>
  2026-04-10 15:59     ` Re: pg_plan_advice: rtekind uninitialized compilation waning Robert Haas <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Nathan Bossart @ 2026-03-13 16:32 UTC (permalink / raw)
  To: Sami Imseih <[email protected]>; +Cc: pgsql-hackers; [email protected]

On Thu, Mar 12, 2026 at 04:20:14PM -0500, Nathan Bossart wrote:
> On Thu, Mar 12, 2026 at 03:16:29PM -0500, Sami Imseih wrote:
>> Attached initializes rtekind to RTE_RELATION to keep the compiler happy.
>> The value is set correctly inside the loop before it's used.
> 
> Looks correct to me.

Committed.

-- 
nathan





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_plan_advice: rtekind uninitialized compilation waning
  2026-03-12 20:16 pg_plan_advice: rtekind uninitialized compilation waning Sami Imseih <[email protected]>
  2026-03-12 21:20 ` Re: pg_plan_advice: rtekind uninitialized compilation waning Nathan Bossart <[email protected]>
  2026-03-13 16:32   ` Re: pg_plan_advice: rtekind uninitialized compilation waning Nathan Bossart <[email protected]>
@ 2026-04-10 15:59     ` Robert Haas <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Robert Haas @ 2026-04-10 15:59 UTC (permalink / raw)
  To: Nathan Bossart <[email protected]>; +Cc: Sami Imseih <[email protected]>; pgsql-hackers

On Fri, Mar 13, 2026 at 12:32 PM Nathan Bossart
<[email protected]> wrote:
> On Thu, Mar 12, 2026 at 04:20:14PM -0500, Nathan Bossart wrote:
> > On Thu, Mar 12, 2026 at 03:16:29PM -0500, Sami Imseih wrote:
> >> Attached initializes rtekind to RTE_RELATION to keep the compiler happy.
> >> The value is set correctly inside the loop before it's used.
> >
> > Looks correct to me.
>
> Committed.

Thanks. Apologies for failing to notice this thread.

-- 
Robert Haas
EDB: http://www.enterprisedb.com





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-04-10 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 20:16 pg_plan_advice: rtekind uninitialized compilation waning Sami Imseih <[email protected]>
2026-03-12 21:20 ` Nathan Bossart <[email protected]>
2026-03-13 16:32   ` Nathan Bossart <[email protected]>
2026-04-10 15:59     ` Robert Haas <[email protected]>

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