Skip to content

build-pg-focal: take the patch series from PGDG's packaging of the same minor - #1244

Open
Kemal Büyükkaya (kemalbuyukkaya) wants to merge 2 commits into
developfrom
users/kbuyukkaya/align-pg-focal-patches-with-pgdg
Open

Kemal Büyükkaya (kemalbuyukkaya) wants to merge 2 commits into
developfrom
users/kbuyukkaya/align-pg-focal-patches-with-pgdg

Conversation

@kemalbuyukkaya

@kemalbuyukkaya Kemal Büyükkaya (kemalbuyukkaya) commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Why the patch series matters

We don't ship plain upstream PostgreSQL. Our packages carry PGDG's version string (16.16-1.pgdg20.04+1), so they have to behave exactly like PGDG's. debian/patches is what makes PostgreSQL fit Debian/Ubuntu. Without it, from a user's point of view:

  1. Two majors can't be installed side by side. PG15 and PG16 would overwrite each other's libraries and headers. The patches give each major its own directories, which the assemble job's combined 13–16 set relies on.
  2. psql can't find the server. Clusters managed by postgresql-common listen in /var/run/postgresql, but plain psql looks in /tmp.
  3. Extensions like Citus won't build or test. Their packaging expects headers and libraries in Debian's locations, and uses the patch-added extension_destdir setting to test before installing.
  4. PGDG's bug fixes are missing. PGDG sometimes patches an upstream bug before the next upstream release.
  5. Builds aren't reproducible. A patch strips the build machine's paths from the output.

The series depends on the minor being built, not on the distro: for each of 13.23 / 14.25 / 15.20 / 16.16, PGDG's series is byte-identical for bookworm, trixie, jammy and noble. A new minor can shift code under a patch, make one obsolete, or need a new fix, so PGDG adjusts the series every release.

Problem

The focal build combines a new upstream minor with PGDG's frozen focal debian/ packaging, including its patch series. That series comes from the last focal minor PGDG built (e.g. 16.9 for PG16), so it falls behind as PGDG keeps adjusting it. For the current minors, we still apply patches PGDG no longer ships:

Major Applied by us, no longer shipped by PGDG
13, 14, 15 focal-arm64-outline-atomics, jit-s390x (no effect on amd64)
16 the two above, plus v8-0001-Fix-recovery-conflict-SIGUSR1-handling (an unmerged rewrite of core server code) and pgstat-report-conflicts-immediately, both s390x workarounds

So our PG16 server runs code that PGDG's 16.16 doesn't. If PGDG adds a fix patch in a later minor, the frozen series misses it too.

Fix

Patch series. In step [3/6] of scripts/build_pg_focal, replace debian/patches with the series from PGDG's jammy packaging of the minor being built (live pool). The tarball's sha256 is checked against its .dsc. The rest of the frozen focal debian/ stays, so the LLVM 10 strategy is unchanged.

  • No manual work each release: when PGDG adds or drops a patch, we follow automatically.
  • PG_DROP_PATCHES stays as an override, but no longer needs its hurd-iovec default (that patch isn't in PGDG's series anymore).
  • The changelog entry records which packaging the patch series came from.

CI trigger. build-pg-focal.yml only ran on push to pg-focal (and on dispatch), so pushes to a PR like this one never exercised it. It now also runs for pull requests that touch the workflow, scripts/build_pg_focal, scripts/smoke_test_focal_debs or dockerfiles/focal-pg-builder/. These runs build the default 13–16 matrix at the latest minors, without tests. Fork PRs are skipped (no Docker Hub / signing secrets).

Validation (13.23 / 14.25 / 15.20 / 16.16)

  • PR-triggered CI (run 44321965761, started by this PR's push): each major uses PGDG's jammy series for the same minor, and it applies with zero fuzz. 23 signed debs per major, JIT on libllvm10. The combined 59-package set installs in stock ubuntu:20.04, with 4 clusters online and JIT available on all.

  • run_tests=1 (run 44322050496): the full upstream test suite passes on every major, with 0 failures. The only not ok lines are upstream # TODO tests.

    Major TAP suites passed pg_regress suites passed
    13.23 29 68
    14.25 37 75
    15.20 40 79
    16.16 43 85
  • Patch series: compared with the frozen series, the only change is that the patches in the table above are gone (plus hurd-iovec on 16). PGDG's extension_destdir is rebased for 14–16, but only its context changed; the code it adds is identical.

  • PG16 server: exports upstream's RecoveryConflictInterrupt, not the v8 patch's HandleRecoveryConflictInterrupt.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The patch selection, checksum verification, extraction, and existing build flow are consistent and complete.

0 open findings

What changed in this PR

Updates focal PostgreSQL builds to use PGDG’s patch series for the matching minor release.

Changes:

  • Downloads and verifies Jammy patch packaging.
  • Preserves optional patch exclusions and records the source in the changelog.
  • Documents the revised packaging strategy.
File Description
scripts/​build_pg_focal Replaces frozen patches with the verified matching PGDG series.
dockerfiles/​focal-pg-builder/​Dockerfile Documents the patch source.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…me minor

The build reused the frozen focal debian/ packaging wholesale, including its
patch series, which stops at the last focal minor (13.21/14.18/15.13/16.9).
So our newer minors drifted from what PGDG ships for them:

  * 14.24/15.19/16.15 lacked PGDG's psql fix for the COPY FROM STDIN
    regression in those minors: psql -c "SELECT 1; COPY t FROM STDIN"
    aborted with "unexpected COPY_IN result, aborting connection".
  * 16.x still carried v8-0001-Fix-recovery-conflict-SIGUSR1-handling
    (an unmerged core-server rework) and pgstat-report-conflicts-
    immediately, which PGDG dropped in 16.10 as s390x workarounds.

PGDG's patch series is identical across distros for a given minor, so take
debian/patches from their jammy packaging of the minor we build, verified
against its .dsc. The rest of the frozen focal debian/ stays, keeping
LLVM 10. PG_DROP_PATCHES no longer needs a default (hurd-iovec is not in
the current series).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The workflow only ran on push to pg-focal (and on dispatch), so pushes to a
PR branch that changes the focal build never exercised it. Also run it for
pull requests touching the workflow, scripts/build_pg_focal,
scripts/smoke_test_focal_debs or dockerfiles/focal-pg-builder/. Such runs
build the default 13-16 matrix at the latest minors, without tests.

Fork PRs get no Docker Hub or signing secrets, so they skip the run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kemalbuyukkaya
Kemal Büyükkaya (kemalbuyukkaya) force-pushed the users/kbuyukkaya/align-pg-focal-patches-with-pgdg branch from 7c7f843 to 84a2815 Compare November 18, 2026 14:13

This branch has not been deployed

No deployments
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