Skip to content

[CI only] Bump PG minors to 16.15 / 17.11 / 18.6 - #8777

Merged
ibrahim halatci (ihalatci) merged 6 commits into
release-14.0from
bump-pg-minors-release-14.0-20260815
Aug 26, 2026
Merged

ibrahim halatci (ihalatci) merged 6 commits into
release-14.0from
bump-pg-minors-release-14.0-20260815

Conversation

@ihalatci

@ihalatci ibrahim halatci (ihalatci) commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

DESCRIPTION: Fail clearly when output_plugin_libraries disallows citus plugin

Validation PR for the-process #242. Repoints CI at the release images carrying the new PostgreSQL minors published 2026-08-14/15.

before after
PG16 16.14 16.15
PG17 17.10 17.11
PG18 18.4 18.6

image_suffix: -ved0dad9

Note: PostgreSQL 18.5 was never released (withdrawn after a regression), so 18.4 -> 18.6 is the correct step.


Fallout from the new minors

Validation surfaced two independent PostgreSQL security changes in this minor set that break Citus.

1. psql COPY FROM STDIN (fixed here)

When a COPY fails early, the new psql silently swallows every line up to and including the next \.. Tests that relied on the old behaviour were adjusted: a terminating \. was added where one was missing, stray statements after a swallowed block were removed, and expected output was trimmed for the lines that no longer execute.

2. output_plugin_libraries (fixed here)

PostgreSQL 14.24, 15.19, 16.15, 17.11 and 18.6 add an output_plugin_libraries GUC. Only the libraries it lists may be used as logical decoding output plugins. It defaults to pgoutput, test_decoding and is superuser-settable, so it takes a reload rather than a restart.

Upgrade note for operators. Citus uses an output plugin named citus for logical replication during non-blocking shard splits. On these minors the following fail until the plugin is allowed:

  • citus_split_shard_by_split_points(..., 'force_logical') and 'auto'
  • create_distributed_table_concurrently()
  • citus_isolate_tenant_to_new_shard(..., 'force_logical' / 'auto')

Shard moves and the rebalancer are unaffected -- they use pgoutput. CDC through the pgoutput shim is unaffected; CDC through wal2json needs the same treatment, exactly as it does on vanilla PostgreSQL.

Remediation, on every node:

ALTER SYSTEM SET output_plugin_libraries = pgoutput, test_decoding, citus;
SELECT pg_reload_conf();

The GUC is GUC_LIST_QUOTE, so quoting the whole list ('pgoutput, test_decoding, citus') stores it as a single name and does not work. Use the bare list above, or quote each element individually.

This PR does not work around the restriction -- allowing a decoder is deliberately an operator action. Instead Citus now fails fast and clearly: a preflight check runs against the source node before any shards, publications or replication slots are created, and raises an error naming the plugin, the node, the current allowlist value, and a ready-to-paste ALTER SYSTEM hint.

The preflight parses the GUC the same way PostgreSQL's own SplitGUCList does: all whitespace is trimmed from each element, and surrounding quotes are removed only when an element is fully quoted, with interior "" collapsed to ". Verified against 16.15 with pg_create_logical_replication_slot as ground truth.

Testing

The regression and CDC harnesses start their own clusters, so in CI we are the operator: pg_regress_multi.pl and cdctestlib.pm now write the allowlist themselves, guarded by a probe of postgresql.conf.sample so they stay compatible with older minors where the GUC does not exist.

To keep the un-remediated path covered, a new check-split-output-plugin-denied job deliberately skips that override (via CITUS_TEST_SKIP_OUTPUT_PLUGIN_ALLOWLIST=1) and asserts that a non-blocking split fails with the new error and leaks no shards, publications or replication slots.

@codecov

codecov Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.27273% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.50%. Comparing base (5c292aa) to head (7e202d9).

Additional details and impacted files
@@               Coverage Diff                @@
##           release-14.0    #8777      +/-   ##
================================================
- Coverage         88.55%   88.50%   -0.06%     
================================================
  Files               289      289              
  Lines             64566    64585      +19     
  Branches           8116     8120       +4     
================================================
- Hits              57177    57159      -18     
- Misses             5048     5085      +37     
  Partials           2341     2341              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

PostgreSQL 14.24/15.19/16.15/17.11/18.6 changed psql so that a COPY ... FROM
STDIN which fails before entering copy-data mode now silently swallows every
following line up to and including the next backslash-dot. Previously psql
read those lines as SQL and reported "invalid command \.".

Three shapes are affected:
 * .sql files where a deliberately-failing COPY had no terminator: add one.
 * expected/ files that recorded the now-vanished data / terminator /
   invalid-command lines: drop them.
 * multi_multiuser_copy.sql had a stray bare ";" after the terminator, which
   under the new behaviour re-enters copy mode and swallows the rest of the
   file: remove it.

No test coverage is lost; only psql echo artefacts change.
PostgreSQL 14.24, 15.19, 16.15, 17.11 and 18.6 only allow the logical
decoding output plugins listed in "output_plugin_libraries". Citus uses
the "citus" plugin for non-blocking shard splits, so splits now fail up
front with an actionable error instead of a bare PostgreSQL error after
shards, publications and replication slots have been created.

Also allow the plugin in the regression and CDC test harnesses, and add a
check-split-output-plugin-denied CI job that deliberately leaves it out so
the new error keeps negative coverage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
- split_output_plugin_denied: DROP SCHEMA reports the unqualified table
  name, so drop the schema prefix from the expected NOTICE.
- failure_copy_to_reference / failure_copy_on_hash: terminate the psql
  \copy blocks that send no data. Newer psql swallows everything up to
  the next \. when a COPY fails, which silently skipped the following
  test blocks.
- shard_split.c: two blank lines between top-level definitions.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
The PostgreSQL minor bumps have merged in the-process, so switch from the
pull-request dev image tags to the release tags built from the merge commits.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
@ihalatci
ibrahim halatci (ihalatci) marked this pull request as ready for review August 19, 2026 20:57
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.

Addresses review feedback from @onurctirtir on #8777.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
@ihalatci
ibrahim halatci (ihalatci) merged commit c457188 into release-14.0 Aug 26, 2026
184 of 217 checks passed
@ihalatci
ibrahim halatci (ihalatci) deleted the bump-pg-minors-release-14.0-20260815 branch August 26, 2026 09:12
ibrahim halatci (ihalatci) added a commit that referenced this pull request Aug 26, 2026
)

DESCRIPTION: Match SplitGUCList semantics parsing
output_plugin_libraries

Backport of the SQL tightening from #8777, addressing @onurctirtir's
review
comment there.

### What was wrong

`ErrorIfOutputPluginNotAllowed()` parsed `output_plugin_libraries` with
`btrim(name, ' "')`, which strips spaces and double quotes from either
end in
any combination. PostgreSQL's real parser is `SplitGUCList` (`guc.c`),
which:

* splits on commas,
* trims **all** whitespace (space, `\t`, `\n`, `\r`, `\f`) from each
element,
* removes the surrounding quotes **only** when an element is *fully*
quoted,
  collapsing interior `""` to `"` and preserving interior whitespace.

The two disagreed in **both** directions:

| `output_plugin_libraries` | PostgreSQL | old SQL | consequence |
|---|---|---|---|
| `" citus "` | ` citus ` -> no match | `citus` -> match | **false
positive**: preflight passes, the split fails later anyway |
| `pgoutput,<TAB>citus` | `citus` -> match | `<TAB>citus` -> no match |
**false negative**: we block a split PostgreSQL would have allowed |

`current_setting()` does not normalize the tab away, so the false
negative is
reachable.

### The fix

Trim `E' \t\n\r\f'` per element, then unwrap a fully-quoted element and
collapse doubled inner quotes -- i.e. exactly what `SplitGUCList` does.

```sql
coalesce(bool_or(CASE WHEN name LIKE '"%"' THEN
  replace(substring(name, 2, length(name) - 2), '""', '"')
  ELSE name END = 'citus'), false)
FROM (SELECT btrim(elem, E' \t\n\r\f') AS name
      FROM unnest(string_to_array(coalesce(
        current_setting('output_plugin_libraries', true), 'citus'), ',')) elem) s
```

Note `\v` is deliberately excluded: `scanner_isspace` does not treat it
as
whitespace, so a POSIX `[[:space:]]` class would over-trim.

### Verification

The expression was extracted straight out of the compiled
`appendStringInfo`
format string and run against PostgreSQL 16.15, using
`pg_create_logical_replication_slot` as 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,
because
`string_to_array` is comma-blind. Unreachable for the name `citus`; left
alone
to keep the change minimal.

Co-authored-by: Copilot App <[email protected]>

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
ibrahim halatci (ihalatci) added a commit that referenced this pull request Aug 26, 2026
)

DESCRIPTION: Match SplitGUCList semantics parsing
output_plugin_libraries

Backport of the SQL tightening from #8777, addressing @onurctirtir's
review
comment there.

### What was wrong

`ErrorIfOutputPluginNotAllowed()` parsed `output_plugin_libraries` with
`btrim(name, ' "')`, which strips spaces and double quotes from either
end in
any combination. PostgreSQL's real parser is `SplitGUCList` (`guc.c`),
which:

* splits on commas,
* trims **all** whitespace (space, `\t`, `\n`, `\r`, `\f`) from each
element,
* removes the surrounding quotes **only** when an element is *fully*
quoted,
  collapsing interior `""` to `"` and preserving interior whitespace.

The two disagreed in **both** directions:

| `output_plugin_libraries` | PostgreSQL | old SQL | consequence |
|---|---|---|---|
| `" citus "` | ` citus ` -> no match | `citus` -> match | **false
positive**: preflight passes, the split fails later anyway |
| `pgoutput,<TAB>citus` | `citus` -> match | `<TAB>citus` -> no match |
**false negative**: we block a split PostgreSQL would have allowed |

`current_setting()` does not normalize the tab away, so the false
negative is
reachable.

### The fix

Trim `E' \t\n\r\f'` per element, then unwrap a fully-quoted element and
collapse doubled inner quotes -- i.e. exactly what `SplitGUCList` does.

```sql
coalesce(bool_or(CASE WHEN name LIKE '"%"' THEN
  replace(substring(name, 2, length(name) - 2), '""', '"')
  ELSE name END = 'citus'), false)
FROM (SELECT btrim(elem, E' \t\n\r\f') AS name
      FROM unnest(string_to_array(coalesce(
        current_setting('output_plugin_libraries', true), 'citus'), ',')) elem) s
```

Note `\v` is deliberately excluded: `scanner_isspace` does not treat it
as
whitespace, so a POSIX `[[:space:]]` class would over-trim.

### Verification

The expression was extracted straight out of the compiled
`appendStringInfo`
format string and run against PostgreSQL 16.15, using
`pg_create_logical_replication_slot` as 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,
because
`string_to_array` is comma-blind. Unreachable for the name `citus`; left
alone
to keep the change minimal.

Co-authored-by: Copilot App <[email protected]>

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
ibrahim halatci (ihalatci) added a commit that referenced this pull request Aug 27, 2026
DESCRIPTION: Fail clearly when output_plugin_libraries disallows citus
plugin

Validation PR for the-process
[#242](citusdata/the-process#242). Repoints CI
at the release images carrying the new PostgreSQL minors published
2026-08-14/15.

| | before | after |
|---|---|---|
| PG16 | 16.14 | 16.15 |
| PG17 | 17.10 | 17.11 |
| PG18 | 18.4 | 18.6 |

`image_suffix`: `-ved0dad9`

Note: PostgreSQL **18.5 was never released** (withdrawn after a
regression), so 18.4 -> 18.6 is the correct step.

---

Validation surfaced two independent PostgreSQL security changes in this
minor set that break Citus.

When a `COPY` fails early, the new psql silently swallows every line up
to and including the next `\.`. Tests that relied on the old behaviour
were adjusted: a terminating `\.` was added where one was missing, stray
statements after a swallowed block were removed, and expected output was
trimmed for the lines that no longer execute.

PostgreSQL 14.24, 15.19, 16.15, 17.11 and 18.6 add an
`output_plugin_libraries` GUC. Only the libraries it lists may be used
as logical decoding output plugins. It defaults to `pgoutput,
test_decoding` and is `superuser`-settable, so it takes a reload rather
than a restart.

**Upgrade note for operators.** Citus uses an output plugin named
`citus` for logical replication during non-blocking shard splits. On
these minors the following fail until the plugin is allowed:

* `citus_split_shard_by_split_points(..., 'force_logical')` and `'auto'`
* `create_distributed_table_concurrently()`
* `citus_isolate_tenant_to_new_shard(..., 'force_logical'` / `'auto')`

Shard **moves** and the rebalancer are unaffected -- they use
`pgoutput`. CDC through the `pgoutput` shim is unaffected; CDC through
`wal2json` needs the same treatment, exactly as it does on vanilla
PostgreSQL.

Remediation, on **every** node:

```sql
ALTER SYSTEM SET output_plugin_libraries = pgoutput, test_decoding, citus;
SELECT pg_reload_conf();
```

The GUC is `GUC_LIST_QUOTE`, so quoting the whole list (`'pgoutput,
test_decoding, citus'`) stores it as a single name and does **not**
work. Use the bare list above, or quote each element individually.

This PR does not work around the restriction -- allowing a decoder is
deliberately an operator action. Instead Citus now **fails fast and
clearly**: a preflight check runs against the source node before any
shards, publications or replication slots are created, and raises an
error naming the plugin, the node, the current allowlist value, and a
ready-to-paste `ALTER SYSTEM` hint.

The preflight parses the GUC the same way PostgreSQL's own
`SplitGUCList` does: all whitespace is trimmed from each element, and
surrounding quotes are removed only when an element is fully quoted,
with interior `""` collapsed to `"`. Verified against 16.15 with
`pg_create_logical_replication_slot` as ground truth.

The regression and CDC harnesses start their own clusters, so in CI *we*
are the operator: `pg_regress_multi.pl` and `cdctestlib.pm` now write
the allowlist themselves, guarded by a probe of `postgresql.conf.sample`
so they stay compatible with older minors where the GUC does not exist.

To keep the un-remediated path covered, a new
`check-split-output-plugin-denied` job deliberately skips that override
(via `CITUS_TEST_SKIP_OUTPUT_PLUGIN_ALLOWLIST=1`) and asserts that a
non-blocking split fails with the new error and leaks no shards,
publications or replication slots.

---------

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c6370b2-06fd-4491-bf92-ecb811d34518
(cherry picked from commit c457188)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants