Repository navigation
Match SplitGUCList semantics when parsing output_plugin_libraries - #8797
Merged
ibrahim halatci (ihalatci) merged 1 commit intoAug 26, 2026
Merged
ibrahim halatci (ihalatci) merged 1 commit into
ibrahim halatci (ihalatci) merged 1 commit into
Conversation
The preflight check used btrim(name, ' "'), which strips spaces and
double quotes from either end in any combination. PostgreSQL's real
parser (SplitGUCList) instead trims all whitespace, then removes the
surrounding quotes only when an element is fully quoted, collapsing
interior "" to ".
The two parsers therefore disagreed in both directions:
'" citus "' PG sees ` citus ` (no match) - we saw a match, so the
preflight passed and the split failed later anyway.
'pgoutput,\tcitus'
PG sees `citus` (match) - we saw `\tcitus`, so we
blocked a split PostgreSQL would have allowed.
current_setting() does not normalize the tab away.
Verified against PostgreSQL 16.15 using
pg_create_logical_replication_slot as ground truth: the new expression
agrees with the server in all probed cases, including tab/newline
separators and doubled inner quotes.
Backport of the fix in #8777, addressing review feedback from
@onurctirtir.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
ibrahim halatci (ihalatci)
merged commit Aug 26, 2026
5fe77a9
into
release-13.2
181 of 213 checks passed
ibrahim halatci (ihalatci)
deleted the
fix-output-plugin-parse-release-13.2
branch
August 26, 2026 09:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESCRIPTION: Match SplitGUCList semantics parsing output_plugin_libraries
Backport of the SQL tightening from #8777, addressing Onur Tirtir (@onurctirtir)'s review
comment there.
What was wrong
ErrorIfOutputPluginNotAllowed()parsedoutput_plugin_librarieswithbtrim(name, ' "'), which strips spaces and double quotes from either end inany combination. PostgreSQL's real parser is
SplitGUCList(guc.c), which:\t,\n,\r,\f) from each element,collapsing interior
""to"and preserving interior whitespace.The two disagreed in both directions:
output_plugin_libraries" citus "citus-> no matchcitus-> matchpgoutput,<TAB>cituscitus-> match<TAB>citus-> no matchcurrent_setting()does not normalize the tab away, so the false negative isreachable.
The fix
Trim
E' \t\n\r\f'per element, then unwrap a fully-quoted element andcollapse doubled inner quotes -- i.e. exactly what
SplitGUCListdoes.Note
\vis deliberately excluded:scanner_isspacedoes not treat it aswhitespace, so a POSIX
[[:space:]]class would over-trim.Verification
The expression was extracted straight out of the compiled
appendStringInfoformat string and run against PostgreSQL 16.15, using
pg_create_logical_replication_slotas ground truth. All probed cases agree,including tab and newline separators, quoted elements with interior spaces, and
doubled inner quotes.
Known, deliberate limitation
A comma inside a quoted element (
"a,b") still splits incorrectly, becausestring_to_arrayis comma-blind. Unreachable for the namecitus; left aloneto keep the change minimal.
Co-authored-by: Copilot App [email protected]