| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Allow GUC settings in CREATE SUBSCRIPTION CONNECTION to take effect |
| Date: | 2025-11-21 07:47:05 |
| Message-ID: | CAHGQGwGYG09DZnx7VVFvr7EfpC12sf+36D6iCSSAFMj66RY2_Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Nov 20, 2025 at 3:54 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> Before this patch, all user specified options are silently discarded,
The GUC settings in CREATE SUBSCRIPTION were honored up through v14;
the behavior changed in commit f3d4019da5d, so some might view this
as a regression.
> now all user specified options expect the 3 will be kept, will that expose a hold where user badly specifies some option that may break logical replication? If that’s true, then we need to parse user specified options and do some verifications.
>
Yeah, I agree that if certain GUCs can break logical replication,
we should enforce "safe" values, just as we currently do for datestyle.
And if any other GUCs can cause the issue, they could affect
postgres_fdw etc, so the fix would need to be broader.
> I just reviewed v2, and got some comments:
Thanks for the review!
>
> 1.
> ```
> + char sql[100];
> ```
>
> Hardcode 100 here doesn’t look good. If you decide to keep, I won’t have a strong objection.
I think hardcoding 100 here is sufficient, since the queries built on
that buffer are fixed and clearly fit within that limit.
>
> 2
> ```
> + const char *params[] =
> + {"datestyle", "intervalstyle", "extra_float_digits", NULL};
> + const char *values[] = {"ISO", "postgres", "3", NULL};
> ```
>
> Nit: we don’t need to have a NULL terminator element. We can use lengthof() macro to get array length. lengthof() is defined in c.h.
Okay, I'll adjust the patch accordingly.
>
> 3. To minimize the network round-trip, maybe we can combine the 3 set into a single statement?
As for the extra network round trip, I still doubt it will matter
in practice given that it happens only at replication connection startup.
>
> 4. The commit message:
> ```
> This commit removes the restriction by changing how logical replication
> connections are established so that GUC settings in the CONNECTION string
> are properly passed through to and uesd by the walsender. This enables
> ```
>
> This is a little bit inaccurate, all user specified settings expected the 3 ones being overwritten will be honored.
Are you suggesting that, because datestyle and the other two parameters
specified in CONNECTION aren(t actually applied by the walsender,
the commit message should explicitly mention that not all parameters
from CONNECTION are used?
Regards,
--
Fujii Masao
| From | Date | Subject | |
|---|---|---|---|
| Next Message | cca5507 | 2025-11-21 08:16:16 | Re: Historic snapshot doesn't track txns committed inBUILDING_SNAPSHOT state |
| Previous Message | Neil Chen | 2025-11-21 07:36:52 | Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ... |