agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feed[PATCH v4 2/2] Update comments for AlterSubscription.
4+ messages / 4 participants
[nested] [flat]
* [PATCH v4 2/2] Update comments for AlterSubscription.
@ 2021-07-16 05:25 Amit Kapila <akapila@postgresql.org>
0 siblings, 0 replies; 4+ messages in thread
From: Amit Kapila @ 2021-07-16 05:25 UTC (permalink / raw)
Add explanation as to why the subscription needs to be disabled to allow
slot_name as none.
Author: Japin Li and Amit Kapila
Discussion: https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
---
src/backend/commands/subscriptioncmds.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index fb0b0058f2..41c8397902 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -912,6 +912,13 @@ AlterSubscription(AlterSubscriptionStmt *stmt, bool isTopLevel)
if (IsSet(opts.specified_opts, SUBOPT_SLOT_NAME))
{
+ /*
+ * The subscription must be disabled to allow slot_name as
+ * 'none', otherwise, the apply worker will repeatedly try
+ * to stream the data using that slot_name which neither
+ * exists on the publisher nor the user will be allowed to
+ * create it.
+ */
if (sub->enabled && !opts.slot_name)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
--
2.28.0.windows.1
--=-=-=--
^ permalink raw reply [nested|flat] 4+ messages in thread
* [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
@ 2026-04-27 05:33 Lakshmi N <lakshmin.jhs@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Lakshmi N @ 2026-04-27 05:33 UTC (permalink / raw)
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
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, ../../CA+3i_M98-XjE-_fw0p+8xOnw64y2_YLtJfcwvCfsVMn-z2ZjGg@mail.gmail.com/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] 4+ messages in thread
* Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
@ 2026-04-27 08:28 Nisha Moond <nisha.moond412@gmail.com>
parent: Lakshmi N <lakshmin.jhs@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Nisha Moond @ 2026-04-27 08:28 UTC (permalink / raw)
To: Lakshmi N <lakshmin.jhs@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
On Mon, Apr 27, 2026 at 11:03 AM Lakshmi N <lakshmin.jhs@gmail.com> 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] 4+ messages in thread
* Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION
@ 2026-04-28 10:57 Amit Kapila <amit.kapila16@gmail.com>
parent: Nisha Moond <nisha.moond412@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Amit Kapila @ 2026-04-28 10:57 UTC (permalink / raw)
To: Nisha Moond <nisha.moond412@gmail.com>; +Cc: Lakshmi N <lakshmin.jhs@gmail.com>; pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
On Mon, Apr 27, 2026 at 1:59 PM Nisha Moond <nisha.moond412@gmail.com> wrote:
>
> On Mon, Apr 27, 2026 at 11:03 AM Lakshmi N <lakshmin.jhs@gmail.com> 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] 4+ messages in thread
end of thread, other threads:[~2026-04-28 10:57 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 05:25 [PATCH v4 2/2] Update comments for AlterSubscription. Amit Kapila <akapila@postgresql.org>
2026-04-27 05:33 [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Lakshmi N <lakshmin.jhs@gmail.com>
2026-04-27 08:28 ` Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Nisha Moond <nisha.moond412@gmail.com>
2026-04-28 10:57 ` Re: [PATCH] Fix Int32GetDatum used for bool column in CREATE SUBSCRIPTION Amit Kapila <amit.kapila16@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox