public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
3+ messages / 3 participants
[nested] [flat]

* [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
@ 2026-04-27 05:33 Lakshmi N <[email protected]>
  2026-04-27 08:28 ` Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Nisha Moond <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Lakshmi N @ 2026-04-27 05:33 UTC (permalink / raw)
  To: [email protected] <[email protected]>

Hi hackers,

In CreateSubscription(), the subretentionactive catalog column (declared as
bool in pg_subscription.h) is populated using Int32GetDatum() instead of
BoolGetDatum():

This writes 4 bytes into a 1-byte bool Datum. It is inconsistent with the
ALTER SUBSCRIPTION path which correctly uses BoolGetDatum().

The attached patch fixes this to use BoolGetDatum(), matching both the
catalog definition and the ALTER path.

Regards,
Lakshmi


Attachments:

  [application/octet-stream] subretentionactive-int32-to-bool.patch (689B, 3-subretentionactive-int32-to-bool.patch)
  download | inline diff:
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index d512e87c..1e10d9d9 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -796,7 +796,7 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
 	values[Anum_pg_subscription_submaxretention - 1] =
 		Int32GetDatum(opts.maxretention);
 	values[Anum_pg_subscription_subretentionactive - 1] =
-		Int32GetDatum(opts.retaindeadtuples);
+		BoolGetDatum(opts.retaindeadtuples);
 	values[Anum_pg_subscription_subserver - 1] = ObjectIdGetDatum(serverid);
 	if (!OidIsValid(serverid))
 		values[Anum_pg_subscription_subconninfo - 1] =


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

* Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
  2026-04-27 05:33 [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Lakshmi N <[email protected]>
@ 2026-04-27 08:28 ` Nisha Moond <[email protected]>
  2026-04-28 10:57   ` Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Amit Kapila <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Nisha Moond @ 2026-04-27 08:28 UTC (permalink / raw)
  To: Lakshmi N <[email protected]>; +Cc: [email protected] <[email protected]>

On Mon, Apr 27, 2026 at 11:03 AM Lakshmi N <[email protected]> wrote:
>
> Hi hackers,
>
> In CreateSubscription(), the subretentionactive catalog column (declared as
> bool in pg_subscription.h) is populated using Int32GetDatum() instead of
> BoolGetDatum():
>
> This writes 4 bytes into a 1-byte bool Datum. It is inconsistent with the
> ALTER SUBSCRIPTION path which correctly uses BoolGetDatum().
>
> The attached patch fixes this to use BoolGetDatum(), matching both the
> catalog definition and the ALTER path.
>

+1
This looks like an oversight in commit a850be2.

--
Thanks,
Nisha





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

* Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
  2026-04-27 05:33 [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Lakshmi N <[email protected]>
  2026-04-27 08:28 ` Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Nisha Moond <[email protected]>
@ 2026-04-28 10:57   ` Amit Kapila <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Amit Kapila @ 2026-04-28 10:57 UTC (permalink / raw)
  To: Nisha Moond <[email protected]>; +Cc: Lakshmi N <[email protected]>; [email protected] <[email protected]>

On Mon, Apr 27, 2026 at 1:59 PM Nisha Moond <[email protected]> wrote:
>
> On Mon, Apr 27, 2026 at 11:03 AM Lakshmi N <[email protected]> wrote:
> >
> > Hi hackers,
> >
> > In CreateSubscription(), the subretentionactive catalog column (declared as
> > bool in pg_subscription.h) is populated using Int32GetDatum() instead of
> > BoolGetDatum():
> >
> > This writes 4 bytes into a 1-byte bool Datum. It is inconsistent with the
> > ALTER SUBSCRIPTION path which correctly uses BoolGetDatum().
> >
> > The attached patch fixes this to use BoolGetDatum(), matching both the
> > catalog definition and the ALTER path.
> >
>
> +1
> This looks like an oversight in commit a850be2.
>

Pushed.

-- 
With Regards,
Amit Kapila.





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


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

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-27 05:33 [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Lakshmi N <[email protected]>
2026-04-27 08:28 ` Nisha Moond <[email protected]>
2026-04-28 10:57   ` Amit Kapila <[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