| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | "jacob(dot)champion(at)enterprisedb(dot)com" <jacob(dot)champion(at)enterprisedb(dot)com> |
| Subject: | pg_createsubscriber does not check output_plugin_libraries |
| Date: | 2026-09-04 03:49:21 |
| Message-ID: | OS9PR01MB12149618ED793133C85A61A34F5B52@OS9PR01MB12149.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Reproduce-missing-output_plugin_libraries-issue.patch | application/octet-stream | 2.4 KB |
| v1-0002-pg_createsubscriber-ensure-output_plugin_librarie.patch | application/octet-stream | 5.8 KB |
| v1-0003-free-allocated-memory-for-max_slot_wal_keep_size.patch | application/octet-stream | 775 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-09-04 03:51:54 | Re: CREATE SCHEMA ... CREATE DOMAIN support |
| Previous Message | ChenhuiMo | 2026-09-04 03:48:49 | [RFC PATCH] Cost-based delayed projection for ORDER BY ... LIMIT |