Skip to content

Branching and Synchronisation

Mohammad Rasoul Kazemi edited this page Nov 27, 2026 · 3 revisions

Branching and Synchronisation

KingresDB is released for PostgreSQL 18 and 19 from one source. This page explains the two product branches, how a change reaches the second one, how the project follows upstream PostgreSQL, and the register of changes to upstream files. The authorities are releases.md, upstream-sync.md and core-patches.md.

Product branches

Branch PostgreSQL What it is
kingres-18 18 Upstream tag REL_18_x (today REL_18_7), the core patches, and the KingresDB directories. Development happens here; it is the default branch
kingres-19 19 Upstream tag REL_19_x (today REL_19_0, PostgreSQL 19.0, merged on 2026-11-22), the same core patches, and the same KingresDB directories. It follows kingres-18 by sync commits and is never edited by hand inside those directories

The KingresDB directories are contrib/kingres_* and kingres/. At every release they are byte for byte the same on both branches: git diff kingres-18 kingres-19 -- 'contrib/kingres_*' kingres prints nothing. kingres-18 is based on an upstream tag, not on the moving REL_18_STABLE tip, so every build is on a released upstream state. Feature branches are short-lived, start from kingres-18 and are merged through review.

How a change reaches kingres-19

  1. The change is made and committed on kingres-18, and only when the suites of every extension it touches pass on both majors (kingres/dev/ext-majors.sh, see Testing Strategy).
  2. A sync commit on kingres-19 takes the KingresDB directories from kingres-18 as they are at a named commit: git checkout <commit of kingres-18> -- 'contrib/kingres_*' kingres, with the message sync from kingres-18 at <short hash>. Nothing is edited by hand on kingres-19 inside those directories. A file that exists on kingres-19 and no longer on kingres-18 must be removed in the same commit: the checkout does not delete it, so git rm -r the paths first and then do the checkout. The diff command above must then print nothing before kingres-19 is pushed.
  3. A core patch that changes is applied to kingres-19 as its own commit, with the register entry updated on kingres-18 first.

kingres-19 is never rebased and never force-pushed by a sync.

Contributors branch from kingres-18 and never edit kingres-19 by hand (Contributing).

Following upstream

upstream-sync.md records the policy as [Recommendation] (the first release, 0.1.0, has been made; kingres-18 is on REL_18_7; kingres-19 merged REL_19_0 on 2026-11-22):

  • Remote upstream is the PostgreSQL repository; mirror branches (proposed names mirror/REL_18_STABLE and mirror/REL_19_STABLE) are fast-forward only and carry no KingresDB commits.
  • A new minor release is taken by rebasing: git rebase --onto <new-tag> <old-tag> kingres-18. Upstream is never merged into the product branch. Each conflict is recorded in the work log with the core patch ID, because conflicts are the measure of whether the thin-fork policy works.
  • Before a rebase the register is reviewed: patches that upstream now provides are dropped and the rest are re-tested.
  • After a rebase: a clean build with assertions; the upstream test suite (failures that also occur on the unmodified tag are reported upstream, not fixed locally); the extension regress and TAP suites with both build systems; the cluster tests; pgindent --check; the Go and web suites if the interface changed; loading every extension to confirm the PG_MODULE_MAGIC ABI check; and a check that line endings stay LF.
  • A new major follows ADR 0023: work on the newest REL_19_* tag in a scratch tree first; each interface difference goes into the extension's src/pg_compat.h, not into the code that uses it; the core-patch series is applied in register order. A new major costs a new section in each pg_compat.h and a test run on all majors, not a second code base.
  • Open items the document names: the hosting platform's branch protection, how long each major is maintained, the exact checks, and the numbering of KingresDB versions relative to PostgreSQL's. A cluster runs one major; moving a cluster between majors is not designed.

Shared history and the rewrite of 2026-11-16

Rebasing rewrites commits; the policy says to announce each rebase in the work log and to force-push kingres-18 only for a rebase onto a new upstream tag, done by a maintainer. The history of both branches was rewritten once, on 2026-11-16, by decision of the project owner, to remove a machine-local path that two scripts carried in early commits. Commit ids noted before that date no longer exist; a clone made earlier must be made again. This is not a precedent: no branch is rewritten in ordinary work and nothing is rewritten after the first release is tagged. Any later rewrite needs the owner's explicit say-so. Pushing kingres-19 needs credentials that may write workflow files whenever the upstream workflow file changes, which happens when the branch moves to a new upstream tag.

Tags

Tags are for releases only. The first release, 0.1.0, was published on 2026-11-28 with the tags kingres-0.1.0-pg18 and kingres-0.1.0-pg19; no other tag exists, and upstream PostgreSQL tags are never pushed to the project repository. Release tags are kingres-<version>-pg18 and kingres-<version>-pg19 (Release Process).

Where checks run

GitHub Actions is off for the repository by decision of the project owner and no workflow of the project is published. PostgreSQL 19's own upstream workflow file (.github/workflows/pg-ci.yml) is part of the kingres-19 tree unchanged and does not run. Every check runs on a developer's machine and its result goes in the work log.

The core-patch register

Core patches are changes to files that exist upstream, outside contrib/kingres_*. They are the most expensive code in the project because each is carried through every rebase.

Rules:

  1. Write an extension first; a core patch is allowed only when an extension cannot do the job, and the reason is recorded.
  2. One patch is one small commit (or a short ordered series) that does one thing.
  3. Each patch has the next free ID KP-NNNN, never reused; the commit subject starts with the ID.
  4. The register row is added in the same commit; a change to an upstream file without a row is rejected.
  5. Prefer adding a hook that could be offered upstream over embedding KingresDB logic in core.
  6. Every code patch has a regression or TAP test that fails without it.
  7. Upstream status is kept current (local only, proposed, accepted in, rejected, obsolete since).

The register has four entries today:

ID File Purpose
KP-0001 meson.build Defines kingres_version and appends (KingresDB <version>) to the long version string; every PostgreSQL version symbol is unchanged
KP-0002 README.md A short KingresDB section above the PostgreSQL README
KP-0003 contrib/meson.build One subdir line per KingresDB extension
KP-0004 LICENSE The text of the AGPL-3.0, the licence of KingresDB's own code

KingresDB builds with meson only; the autoconf files are left as upstream ships them. Commit message format: KP-NNNN: summary, then Why, What, Tests and Upstream lines.

Sources

Clone this wiki locally