pg_createsubscriber does not check output_plugin_libraries
pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Вложения:
Hi hackers,
(CC: Jacob, who was an author of 226e49cb)
I found a possible oversight in 226e49cb. pg_createsubscriber could fail due to
a missing configuration for output_plugin_libraries. Please see the reproducer
and a fix patch.
Background
========
226e49cb added a GUC parameter to specify trusted output plugins, and slot creation
would fail if a give plugin is not listed there.
```
postgres=# SHOW output_plugin_libraries ;
output_plugin_libraries
-------------------------
test_decoding
(1 row)
postgres=# SELECT * FROM pg_create_logical_replication_slot('s1', 'pgoutput');
ERROR: library "pgoutput" may not be used as an output plugin
HINT: If it is safe for all REPLICATION users to use this library as an output plugin, add it to "output_plugin_libraries" and reload the server configuration.
```
Found issues
========
pg_createsubscriber command creates replication slots with plugin 'pgoutput',
without checking the GUC. This meant if the plugin name is not specified in the
parameter, --dry-run mode passes but actual convertion fails.
It's very surprising for users and should be avoided.
Attached 0001 patch is a reproducer, which is not intented to be pushed.
Possible fix
=======
I think pg_createsubscriber can check the parameter in check_publisher().
Attached 0002 patch does the same.
Note
====
BTW, I noticed that `char *max_slot_wal_keep_size` is pg_strdup'd but not free'd.
0003 fixes that.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
RE: pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Вложения:
Dear Fujii-san, Thanks for reviewing. I think your points are correct. PSA new version. Only needed patches were attached. IIUC the same issue could happen till PG18. Not sure the case when GUC was added to the old version, but I feel it could be backpatched. Patches for PG18 were also attached. For PG19, same ones as HEAD were usable. Best regards, Hayato Kuroda FUJITSU LIMITED
RE: pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Вложения:
Dear hackers, I found the content was truncated. There might be an environment issue on my side. PSA correct ones. Best regards, Hayato Kuroda FUJITSU LIMITED
Re: pg_createsubscriber does not check output_plugin_libraries
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Tue, Sep 8, 2026 at 7:52 PM Hayato Kuroda (Fujitsu)
wrote:
> Good point, should be fixed. I came up with an idea to spedcify missing_ok := true
> for current_setting(), and skip checking if it returns NULL. Thought?
Using missing_ok = true seems fine for older minor versions that don't
support output_plugin_libraries, but it doesn't handle insufficient
privileges cases, does it? current_setting('output_plugin_libraries', true)
still raises a permission-denied error if the current user cannot examine
the setting, no?
How about querying pg_settings instead? For example,
SELECT setting
FROM pg_catalog.pg_settings
WHERE name = 'output_plugin_libraries';
This returns no rows if the parameter doesn't exist or the current user
doesn't have permission to examine it, so we could skip the check for
that database in either case.
Regards,
--
Fujii Masao
Re: pg_createsubscriber does not check output_plugin_libraries
On Wed, Sep 9, 2026 at 3:33 AM Hayato Kuroda (Fujitsu) wrote: > Thanks for giving feedbacks. I'm confusing and let me confirm few points. > The situation might be different before and after the PG19. Oh, that's a good point. > In this thread I do not want to broaden for other points and focus on the added > GUC, thought? In other threads we can improve --check option more. As long as everyone is in agreement that --dry-run *should* be performing those checks in the first place, I'm happy. I just wasn't sure from looking at the code if it was intended to perform any permissions checks at all, so I was trying to figure out what my original patch should have done differently. Even for PG17, specifying a non-superuser in the connection string leads to a successful --dry-run, then fails during normal operation. If our answer to that is "don't do that in the back branches", fine by me -- but then we could also say "don't remove pgoutput from output_plugin_libraries and then be surprised when all subscription operations fail." (The role of each builtin plugin should probably be better explained in the documentation for output_plugin_libraries, since this is a brand-new consideration for most people...) Thanks, --Jacob
[PATCH] Explain what the default output_plugin_libraries do
On Wed, Sep 9, 2026 at 5:43 AM Jacob Champion wrote: > (The role of each builtin plugin should probably be > better explained in the documentation for output_plugin_libraries, > since this is a brand-new consideration for most people...) Splitting this concern off from the original report: I'd like to backpatch something like the attached so that it's more obvious why you might (or might not) want to keep those in the list in the first place. WDYT? Thanks, --Jacob
RE: pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
> As long as everyone is in agreement that --dry-run *should* be > performing those checks in the first place, I'm happy. Yes, it's my intention. Fujii-san, how do you feel? If you're OK, we can proceed. > Even for PG17, specifying a non-superuser in the connection string > leads to a successful --dry-run, then fails during normal operation. To confirm, is it allowed to add such a verification in back branches? I imagined running something like below after connecting to the publisher. ``` SELECT rolsuper FROM pg_catalog.pg_roles WHERE rolname = session_user; ``` Best regards, Hayato Kuroda FUJITSU LIMITED
Re: pg_createsubscriber does not check output_plugin_libraries
От:
Chao Li <li.evan.chao@gmail.com>
Дата:
> On Sep 9, 2026, at 00:33, Jacob Champion wrote: > > On Thu, Sep 3, 2026 at 8:49 PM Hayato Kuroda (Fujitsu) > wrote: >> >> Hi hackers, >> (CC: Jacob, who was an author of 226e49cb) > > Hi! Thanks for the report, and sorry for the delay over the US holiday weekend. > >> 226e49cb added a GUC parameter to specify trusted output plugins, and slot creation >> would fail if a give plugin is not listed there. > > Right. (pgoutput is in that parameter by default, so the case in > question requires a DBA to remove it and then be surprised at the > results.) > >> pg_createsubscriber command creates replication slots with plugin 'pgoutput', >> without checking the GUC. This meant if the plugin name is not specified in the >> parameter, --dry-run mode passes but actual convertion fails. >> It's very surprising for users and should be avoided. > > Isn't this the same behavior as for all other permissions issues? We > don't check for > - REPLICATION privs > - permission for FOR ALL TABLES > - CREATE on the target databases > - ownership on a publication to drop > - permission to call pg_log_standby_snapshot() > > Looks like all those pass a --dry-run and then fail later. > That’s a fair point. The distinction I had in mind is that this patch explicitly adds a check for output_plugin_libraries to make --dry-run more useful. But when the caller cannot read that setting, pg_createsubscriber simply does not have enough information to perform the check. Would it make sense to print a warning in that case, rather than silently letting --dry-run succeed? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
Re: pg_createsubscriber does not check output_plugin_libraries
От:
Chao Li <li.evan.chao@gmail.com>
Дата:
> On Sep 9, 2026, at 18:33, Hayato Kuroda (Fujitsu) wrote: > > Dear Fujii-san, Jacob, > > Thanks for giving feedbacks. I'm confusing and let me confirm few points. > The situation might be different before and after the PG19. > > For PG17 and 18, FOR ALL TABLES publications for publisher databases, > it meant superuser is required for the connection. IIUC superuser can bypass all > permission checks thus it might be OK not to check these points. > (We may have to check it though). > As for the PG19 and HEAD, we allowed to re-use existing publications [1], it > effectively allowed to use non-superuser for connecting to the publisher. > However it meant additional permission checks might be needed like Jacob pointed > out. > > In this thread I do not want to broaden for other points and focus on the added > GUC, thought? In other threads we can improve --check option more. > > Based on that, permission check is actually needed for PG19/HEAD same check > Fujii-san pointed out. For PG18/17, we may not have to take care the usage of > current_setting() but same code is used for better understanding. Attached patch > set does accordingly. v5-0001 also has a test for the case just in case, but not > sure it should be pushed. > > [1]: https://github.com/postgres/postgres/commit/85ddcc2f4cdef490276d151c80459e287bceb782 > > Best regards, > Hayato Kuroda > FUJITSU LIMITED > > I have nit comment on 0001: ``` +/* + * Check per-database settings on the publisher + */ +static void +check_publisher_per_database(const struct LogicalRepInfo *dbinfo) ``` I find the header comment slightly misleading. Although output_plugin_libraries is checked separately for each database connection, its effective value may come from database, role, or connection-level settings. So, maybe rephrase it as: Check effective settings for each publisher database. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
RE: [PATCH] Explain what the default output_plugin_libraries do
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Dear Jacob, > > 1. > > Wondering we need to add descriptions in logical-decoding.sgml. One idea is > > something like below, are there better ideas? > > Possibly in a new "installation" section? Sounds good. Maybe we can clarify that the same loading mechanism is used as the C functions but no need to run CREATE EXTENSION and LOAD command, thought? > > The description may not be accurate because the --plugin is referred only at the > > creation phase. > > My goal on this particular page is only to highlight the command-line > incompatibility. The linked-to section for --plugin says > > When creating a slot, use the specified logical decoding output plugin. > See Chapter 47. This option has no effect if the slot already exists. > > which seems detailed enough to me; thoughts? After considering again, it might not be good to describe too detail in different pages. So OK for me to retain. Best regards, Hayato Kuroda FUJITSU LIMITED
RE: pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Dear Jacob, > > + /* > > + * Should not happen. (Frontend and backend GUC_LIST_QUOTE parsing > > + * have to remain compatible for pg_dump at minimum.) > > + */ > > I spun for a while on the network compatibility implications of this, > until I realized that pg_createsubscriber isn't going to work if the > source server is a different major version (even though it doesn't > explicitly check the source server's version, AFAICT?). Your understanding is correct. IIUC, pg_createsubscriber ensures that 1) the major version of the target server is same as the pg_createsubscriber's one, and 2) the target is working as a hot standby of a source. These points ensure that all source, target and the executable have a same major versions. > If that's > correct, this code should be fine. I haven't reviewed line-by-line, > but the general approach LGTM. OK. But the comment can be simpler just like "Should not happen". IIRC pg_dump command is not used here. Best regards, Hayato Kuroda FUJITSU LIMITED
RE: pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Dear Chao, > That’s a fair point. The distinction I had in mind is that this patch explicitly adds a > check for output_plugin_libraries to make --dry-run more useful. But when the > caller cannot read that setting, pg_createsubscriber simply does not have enough > information to perform the check. Would it make sense to print a warning in that > case, rather than silently letting --dry-run succeed? Hmm. IIUC there several three options; 1) raise WARNING, which is visible by default 2) raise INFO/DEBUG, which is visible with -v option 3) raise nothing. But not sure which option is the best. Personally 1) might not be a good. WARNINGs are reported with hints which the user can do. But in this case there are no workarounds - to request changing a replication user is not suitable. For now I'm not excited to print something at that time, any other thoughts? Best regards, Hayato Kuroda FUJITSU LIMITED
RE: pg_createsubscriber does not check output_plugin_libraries
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Вложения:
Hi hackers, Here is a v6 patch set. What's new: * Fixed a code comment for SplitGUCList() based on [1]. * Fixed code comments for check_publisher_per_database() based on [2]. [1]: https://www.postgresql.org/message-id/TYRPR01MB12845F38A9E0ACF1487EA8F7EF5B92%40TYRPR01MB12845.jpnprd01.prod.outlook.com [2]: https://www.postgresql.org/message-id/548B1C2F-8368-465D-8309-930A7EE58A90%40gmail.com Best regards, Hayato Kuroda FUJITSU LIMITED
Re: pg_createsubscriber does not check output_plugin_libraries
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Wed, Sep 16, 2026 at 3:55 PM Hayato Kuroda (Fujitsu)
wrote:
>
> Hi hackers,
>
> Here is a v6 patch set. What's new:
Thanks for updating the patches!
+ The source server must also allow the pgoutput output
+ plugin by setting to include
+ pgoutput.
Isn't it better to clarify that this requirement applies to the effective
setting for each source database connection? For example:
The effective value of
for each connection to a source database must include
pgoutput.
+ if (!SplitGUCList(output_plugin_libraries_copy, ',', &allowed_plugins))
+ {
+ /* Should not happen */
+ pg_fatal("could not parse \"output_plugin_libraries\" setting '%s'
in database \"%s\"",
+ output_plugin_libraries, dbinfo[i].dbname);
The "Should not happen" comment should be removed because this can happen?
For example, if output_plugin_libraries is set to 'test_decoding, ' on
the server, pg_createsubscriber fails to parse it and reaches this point.
+ qr/publisher does not allow the "pgoutput" output plugin in database
"\Q$db2\E"/,
+ 'primary does not allow to load pgoutput plugin');
"primary" should be "publisher"? For example, how about
"publisher disallows pgoutput output plugin"?
+# output_plugin_libraries is invisible to non-superusers, so its check should
+# be skipped even when pgoutput is not allowed.
This comment seems a bit misleading because non-superusers with
pg_read_all_settings privileges can read this setting. Instead, how about
"This user cannot read output_plugin_libraries, so the check should be
skipped even when pgoutput is not allowed."?
Regarding the backpatch of the 0001 patch, I'm leaning toward treating this
as an improvement for master only.
Regards,
--
Fujii Masao
RE: pg_createsubscriber does not check output_plugin_libraries
Dear Fujii-san,
> + The source server must also allow the pgoutput output
> + plugin by setting to include
> + pgoutput.
>
> Isn't it better to clarify that this requirement applies to the effective
> setting for each source database connection? For example:
>
> The effective value of
> for each connection to a source database must include
> pgoutput.
Fixed.
> + if (!SplitGUCList(output_plugin_libraries_copy, ',', &allowed_plugins))
> + {
> + /* Should not happen */
> + pg_fatal("could not parse \"output_plugin_libraries\" setting '%s'
> in database \"%s\"",
> + output_plugin_libraries, dbinfo[i].dbname);
>
> The "Should not happen" comment should be removed because this can happen?
> For example, if output_plugin_libraries is set to 'test_decoding, ' on
> the server, pg_createsubscriber fails to parse it and reaches this point.
Right, removed. I expected that such a setting can be rejected.
> + qr/publisher does not allow the "pgoutput" output plugin in database
> "\Q$db2\E"/,
> + 'primary does not allow to load pgoutput plugin');
>
> "primary" should be "publisher"? For example, how about
> "publisher disallows pgoutput output plugin"?
Some other lines are referred the source as primary, so I think either way is fine.
But fixed accordingly because the line just above uses the term "publisher".
> This comment seems a bit misleading because non-superusers with
> pg_read_all_settings privileges can read this setting. Instead, how about
> "This user cannot read output_plugin_libraries, so the check should be
> skipped even when pgoutput is not allowed."?
Right, fixed. I described correctly in the source but omitted in the test.
> Regarding the backpatch of the 0001 patch, I'm leaning toward treating this
> as an improvement for master only.
It's still debatable point. I felt this parameter was introduced to stable branches
and missed checking in the command.
I'm not sure existing examples we could follow, do you know?
Anyway, I updated a patch set, only for master.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
Re: pg_createsubscriber does not check output_plugin_libraries
От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Wed, Sep 16, 2026 at 2:06 AM Fujii Masao wrote: > The "Should not happen" comment should be removed because this can happen? > For example, if output_plugin_libraries is set to 'test_decoding, ' Ugh, the fact that you can do that at all is a bug. Thank you for pointing it out; I'll fix it. > Regarding the backpatch of the 0001 patch, I'm leaning toward treating this > as an improvement for master only. That sounds reasonable to me. --Jacob
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Tue, Sep 15, 2026 at 10:01 PM Hayato Kuroda (Fujitsu) wrote: > > Possibly in a new "installation" section? > > Sounds good. Maybe we can clarify that the same loading mechanism is used as the > C functions but no need to run CREATE EXTENSION and LOAD command, thought? Sounds fine in concept (though I wouldn't necessarily want to backport and/or skip beta review for this new section). Any recommended wording? > > My goal on this particular page is only to highlight the command-line > > incompatibility. The linked-to section for --plugin says > > > > When creating a slot, use the specified logical decoding output plugin. > > See Chapter 47. This option has no effect if the slot already exists. > > > > which seems detailed enough to me; thoughts? > > After considering again, it might not be good to describe too detail in different > pages. So OK for me to retain. Okay. Any thoughts on Bharath's note on "publication slot creation" above? Thanks, --Jacob
RE: [PATCH] Explain what the default output_plugin_libraries do
Dear Jacob, > Sounds fine in concept (though I wouldn't necessarily want to backport > and/or skip beta review for this new section). Any recommended > wording? Yes, this cannot be backported. How about attached? > Okay. Any thoughts on Bharath's note on "publication slot creation" above? I could not find the term "publication slot" in the existing doc, so I prefer his idea. Another one I came up with to just simplify: ``` Removing from output_plugin_libraries will cause future logical replication to fail with an error. (Beware that existing replication tools may not degrade gracefully if the server is configured in this way.) ``` Best regards, Hayato Kuroda FUJITSU LIMITED
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Thu, Sep 17, 2026 at 1:42 AM Hayato Kuroda (Fujitsu)
wrote:
> How about attached?
> + An output plugin must be installed as a dynamically loadable library in a
> + location where the server can find it (see ).
I think we should explicitly recommend installation into the
dynamic_library_path ($libdir for most people). Anything outside of
dynamic_library_path couples clients to the directory layout, and it
makes output_plugin_libraries maintenance harder/uglier.
> > Okay. Any thoughts on Bharath's note on "publication slot creation" above?
>
> I could not find the term "publication slot" in the existing doc, so I prefer
> his idea. Another one I came up with to just simplify:
>
> ```
> Removing from output_plugin_libraries will cause future logical replication to
> fail with an error. (Beware that existing replication tools may not degrade gracefully
> if the server is configured in this way.)
But only built-in logical replication will fail. How about
Core plugin for logical replication. Removing
pgoutput
from output_plugin_libraries will cause future
subscription connections, and maintenance of the replication slots
for subscriptions, to fail with an error. (Beware that ...
?
Thanks!
--Jacob
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Дата:
Hi, On Mon, Sep 21, 2026 at 9:02 AM Jacob Champion wrote: > > > > Okay. Any thoughts on Bharath's note on "publication slot creation" above? > > > > I could not find the term "publication slot" in the existing doc, so I prefer > > his idea. Another one I came up with to just simplify: > > > > ``` > > Removing from output_plugin_libraries will cause future logical replication to > > fail with an error. (Beware that existing replication tools may not degrade gracefully > > if the server is configured in this way.) > > But only built-in logical replication will fail. How about > > Core plugin for logical replication. Removing > pgoutput > from output_plugin_libraries will cause future > subscription connections, and maintenance of the replication slots > for subscriptions, to fail with an error. (Beware that ... > > ? This part works for me. Thanks. -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
Chao Li <li.evan.chao@gmail.com>
Дата:
> On Sep 22, 2026, at 06:45, Bharath Rupireddy wrote:
>
> Hi,
>
> On Mon, Sep 21, 2026 at 9:02 AM Jacob Champion
> wrote:
>>
>>>> Okay. Any thoughts on Bharath's note on "publication slot creation" above?
>>>
>>> I could not find the term "publication slot" in the existing doc, so I prefer
>>> his idea. Another one I came up with to just simplify:
>>>
>>> ```
>>> Removing from output_plugin_libraries will cause future logical replication to
>>> fail with an error. (Beware that existing replication tools may not degrade gracefully
>>> if the server is configured in this way.)
>>
>> But only built-in logical replication will fail. How about
>>
>> Core plugin for logical replication. Removing
>> pgoutput
>> from output_plugin_libraries will cause future
>> subscription connections, and maintenance of the replication slots
>> for subscriptions, to fail with an error. (Beware that ...
>>
>> ?
>
> This part works for me. Thanks.
>
This also looks good to me.
I have the other nitpick:
```
PostgreSQL distribution.
+ ( documents the
+ behavior of the system if they are removed from this list.)
```
I tried to build the HTML page, and see that for the effects of removing these plugins from the list.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Re: [PATCH] Explain what the default output_plugin_libraries do
On Mon, Sep 21, 2026 at 11:09 PM Chao Li wrote: > I tried to build the HTML page, and see that for the effects of removing these plugins from the list. Mm, it's easier for my brain to figure out *why* we're saying it with the parenthetical, because it's meant to be an aside. "If you're motivated to remove these, maybe take a look at what they do first. Otherwise, don't worry about it and keep reading." It's the sort of thing a book might use a footnote for, but it's really difficult to use footnotes well on these pages. -- Thanks everybody for the reviews! v2 has the backpatchable piece. It doesn't incorporate Kuroda-san's suggested new section from upthread, since that's master-only and can be committed separately once we have the wording we like. --Jacob
Re: [PATCH] Explain what the default output_plugin_libraries do
> On Sep 23, 2026, at 04:56, Jacob Champion wrote: > > On Mon, Sep 21, 2026 at 11:09 PM Chao Li wrote: >> I tried to build the HTML page, and see that
RE: [PATCH] Explain what the default output_plugin_libraries do
Dear Jacob, > But only built-in logical replication will fail. How about > > Core plugin for logical replication. Removing > pgoutput > from output_plugin_libraries will cause future > subscription connections, and maintenance of the replication slots > for subscriptions, to fail with an error. (Beware that ... Sorry for late, LGTM. Regarding the point raised by Chao, I have no strong opinion for both. But there are cases that string in-between () can be a complete statement. Did it mean that Jacob's one does not also break the existing rule? Best regards, Hayato Kuroda FUJITSU LIMITED
RE: [PATCH] Explain what the default output_plugin_libraries do
Dear Jacob, > > + An output plugin must be installed as a dynamically loadable library in a > > + location where the server can find it (see linkend="xfunc-c-dynload"/>). > > I think we should explicitly recommend installation into the > dynamic_library_path ($libdir for most people). Anything outside of > dynamic_library_path couples clients to the directory layout, and it > makes output_plugin_libraries maintenance harder/uglier. +1, see attached v2. Best regards, Hayato Kuroda FUJITSU LIMITED
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Tue, Sep 22, 2026 at 10:22 PM Chao Li wrote: > My impression was based on the same page (see the attached screenshot). As indicated by the red lines, the other asides are all short phrases, whereas this new one is a complete sentence. There is a similar case, marked in blue, that does not use parentheses. I think this is pursuing a type of consistency that doesn't lead to better readability. I plan to keep the sentence as-is for now (but that doesn't mean it has to remain that way, if people agree there's a better way to write it). Thanks, --Jacob
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Tue, Sep 22, 2026 at 1:56 PM Jacob Champion wrote: > Thanks everybody for the reviews! v2 has the backpatchable piece. It > doesn't incorporate Kuroda-san's suggested new section from upthread, > since that's master-only and can be committed separately once we have > the wording we like. (This first part has been backpatched; the new draft section remains for master. Any other opinions on that one? No rush.) Thanks, --Jacob
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
João Rito <joaovictor.rito@gmail.com>
Дата:
Hi Kuroda-san, Jacob, Thanks for the patches. I reviewed v7 (CF entry 7271) and tested it locally. Jacob, I also added my opinion on the new documentation section you asked about at the end. What I tested - v7-0001 and v7-0002 apply cleanly with "git apply" on master at 9f191dce61e (no rebase needed). Build with --enable-cassert --enable-debug has no warnings. - v7-0001 does not apply to REL_18_STABLE (f5c41f6681c) or REL_17_STABLE (702b3dc86d3), which is expected since v6/v7 are master-only. I did not build the older branches. - Reproducer (primary plus a physical standby from pg_basebackup, two databases db1 and db2, and "ALTER DATABASE db2 SET output_plugin_libraries = 'test_decoding'"): - Without the patch: "pg_createsubscriber --dry-run --database db1 --database db2" succeeds (rc=0). The real run on a fresh standby then fails (rc=1) with: could not create replication slot "pg_createsubscriber_16385_..." in database "db2": ERROR: library "pgoutput" may not be used as an output plugin. - With the patch: both the dry run and the real run fail early with rc=1 and the hint: Add "pgoutput" to the configuration parameter "output_plugin_libraries". - After "ALTER DATABASE db2 RESET output_plugin_libraries", the run works with and without the patch (control). - make -C src/bin/pg_basebackup check with the patch: 040_pg_createsubscriber.pl passes (63 tests), and the whole directory passes (6 files, 366 tests). Comments 1. The check opens one extra connection per database (check_publisher() already connects to the first one, and setup_publisher() connects again later). This is not a problem, just an observation. It also stops at the first database that does not allow pgoutput, so a user with several such databases sees them one by one. That seems fine to me. 2. The hint only says to add "pgoutput" to the parameter. Since the value is often set per database or per role (which is the reason for the per-database loop), it may help to say that in the message, for example by mentioning the effective value for that database. Not a blocker. 3. When the setting cannot be read, the check is skipped silently. I agree with Kuroda-san that a WARNING without an action for the user is not great. Maybe a pg_log_debug() line in that branch, so that "-v" shows that the check was skipped, would be enough. 4. Small cleanup: in the "could not obtain publisher settings" branch, the result is not cleared before disconnect_database(conn, true). It exits anyway, so this is harmless. 5. Error messages, the docs addition in pg_createsubscriber.sgml, the guc_parameters.dat comment and the tests (database-level setting and the non-superuser case) look good to me. v7-0002 (pg_free of max_slot_wal_keep_size) is correct and could be committed with 0001. 6. CF process: the entry currently shows "Patch version v2, 1 patch, +19-0", which is only the documentation patch, so cfbot does not test the v7 code patch. It may be good to attach v7 (0001 and 0002) to the thread again together with the doc patch, or split them into two CF entries. Backpatch I agree with Fujii-san that this should be master only. With the patch, a connection and a query are added to the publisher check, and the same dry-run limitation already exists for other permission problems (as Jacob mentioned), so it reads as an improvement to --dry-run and not as a bug fix. Jacob's question about the new section "Installing Logical Decoding Output Plugins" (doc v2) I only read this patch and did not build the HTML. The content looks right to me and I think master only is fine for a new section. One small wording point: "An output plugin must be installed as a dynamically loadable library" is not true for the built-in pgoutput, so maybe "A custom output plugin" or "An output plugin that is not built in". Overall, the code patch looks good to me and I would be fine with Ready for Committer after the (optional) comments above. Best regards, João Rito Em ter., 10 de nov. de 2026 às 20:38, Jacob Champion escreveu: > > On Tue, Sep 22, 2026 at 1:56 PM Jacob Champion > wrote: > > Thanks everybody for the reviews! v2 has the backpatchable piece. It > > doesn't incorporate Kuroda-san's suggested new section from upthread, > > since that's master-only and can be committed separately once we have > > the wording we like. > > (This first part has been backpatched; the new draft section remains > for master. Any other opinions on that one? No rush.) > > Thanks, > --Jacob > > > >
RE: [PATCH] Explain what the default output_plugin_libraries do
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Hi João,
Thanks for sending a comment! For now let's focusing on the doc patch.
> One
> small wording point: "An output plugin must be installed as a
> dynamically loadable library" is not true for the built-in pgoutput,
> so maybe "A custom output plugin" or "An output plugin that is not
> built in".
Hmm, I felt that the wording is correct. IIUC a shared library pgoutput.so must
be installed on the dynamically loadable library. I locally removed the .so then
tried to create a slot, got the below error.
```
postgres=# SELECT * FROM pg_create_logical_replication_slot('test', 'pgoutput');
ERROR: could not access file "pgoutput": No such file or directory
```
Can you clarify bit more if you mention the different point? Or can you share me
what you tested?
Best regards,
Hayato Kuroda
FUJITSU LIMITED
RE: [PATCH] Explain what the default output_plugin_libraries do
Hi, > (This first part has been backpatched; Verified your commit, LGTM. > the new draft section remains > for master. Any other opinions on that one? No rush.) OK for me to update the master. Let me attach just in case, no updates. Best regards, Hayato Kuroda FUJITSU LIMITED
Re: [PATCH] Explain what the default output_plugin_libraries do
От:
João Rito <joaovictor.rito@gmail.com>
Дата:
Hi Kuroda-san, Thanks for checking this and for testing it. You are right, and I withdraw my wording comment. Before, I had only read the patch. This time I applied the v2 doc patch to current master (8d87367b39e) and tested each sentence of the new section against the server: - I moved test_decoding.so out of $libdir. Creating a test_decoding slot then fails with 'could not access file "test_decoding": No such file or directory'. After adding the new directory to dynamic_library_path and reloading, the slot is created by name. So the "dynamically loadable library" and dynamic_library_path sentences match the behavior, as your pgoutput test also showed. - The slot is created without LOAD and without CREATE EXTENSION (test_decoding is not in pg_extension). - With output_plugin_libraries = 'pgoutput', creating a test_decoding slot fails with 'library "test_decoding" may not be used as an output plugin', with the HINT to add it to output_plugin_libraries. pgoutput still works, and after RESET the test_decoding slot works again. - The xmllint validation (make check in doc/src/sgml) reported no errors, make html finished, and all the links in the new section resolve. So the section looks good to me. Sorry for the noise earlier. Thanks, João