]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix issue with EVENT TRIGGERS and ALTER PUBLICATION
authorDavid Rowley <drowley@postgresql.org>
Tue, 6 Jan 2026 04:30:57 +0000 (17:30 +1300)
committerDavid Rowley <drowley@postgresql.org>
Tue, 6 Jan 2026 04:30:57 +0000 (17:30 +1300)
commitf20b79059ea392ef3cef084033508d5d43bf20d9
treebce7c69a998d0c1e41eeef4f6bd1a1d95e8e3e26
parentec8d91c7e78c075a8ab4e8562dfe49ac568e43b4
Fix issue with EVENT TRIGGERS and ALTER PUBLICATION

When processing the "publish" options of an ALTER PUBLICATION command,
we call SplitIdentifierString() to split the options into a List of
strings.  Since SplitIdentifierString() modifies the delimiter
character and puts NULs in their place, this would overwrite the memory
of the AlterPublicationStmt.  Later in AlterPublicationOptions(), the
modified AlterPublicationStmt is copied for event triggers, which would
result in the event trigger only seeing the first "publish" option
rather than all options that were specified in the command.

To fix this, make a copy of the string before passing to
SplitIdentifierString().

Here we also adjust a similar case in the pgoutput plugin.  There's no
known issues caused by SplitIdentifierString() here, so this is being
done out of paranoia.

Thanks to Henson Choi for putting together an example case showing the
ALTER PUBLICATION issue.

Author: sunil s <sunilfeb26@gmail.com>
Reviewed-by: Henson Choi <assam258@gmail.com>
Reviewed-by: zengman <zengman@halodbtech.com>
Backpatch-through: 14
src/backend/commands/publicationcmds.c
src/backend/replication/pgoutput/pgoutput.c