Skip to content

Upgrade PostgreSQL stack to PG18 - #67

Merged
paudley merged 2 commits into
mainfrom
pg_18
May 23, 2026
Merged

Upgrade PostgreSQL stack to PG18#67
paudley merged 2 commits into
mainfrom
pg_18

Conversation

@paudley

@paudley paudley commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #66.

  • Upgrade the PostgreSQL stack defaults to PostgreSQL 18 / 18.4-bookworm-core.
  • Pin Apache AGE to the PG18-compatible PG18/v1.7.0-rc0 ref and teach the upgrade helper to move AGE pins when changing PostgreSQL majors.
  • Keep container PGDATA on /var/lib/postgresql/data for pgautoupgrade compatibility and avoid installing unversioned postgresql-contrib packages.
  • Refresh CI, publish workflow, examples, and release docs for the PG18 default.
  • Add coding-ethos runtime ignores needed by the installed local hook tooling.

Dependabot PRs

The open Dependabot PRs #55, #56, and #57 all target docker/pghero/app/Gemfile.lock. This branch is based on main after d4f5230, which removed PgHero due to critical security vulnerabilities, so there is no PgHero lockfile to update and those dependency bumps are superseded by the removal.

Validation

  • docker build -t core_data/postgres:pg18-upgrade-check -f postgres/Dockerfile .
  • Image inspection confirmed PG_MAJOR=18, PG_VERSION=18.4-1.pgdg12+1, PGDATA=/var/lib/postgresql/data, no PostgreSQL 15 package tree, and expected extension control files present.
  • bash -n scripts/lib/upgrade.sh postgres/initdb/00-render-config.sh
  • docker compose config --quiet
  • uv run python -m pytest tests/test_lightweight.py
  • coding-ethos-lint staged check passed with one duplicate-workflow-structure warning.

Caveats

  • ./scripts/manage.sh config-check currently fails on local rendered config drift: existing postgresql.conf has timezone = 'UTC', while the rendered template expects timezone = 'America/Edmonton'; pg_hba.conf matches.
  • Local git hooks are installed but reference a missing coding-ethos/pre-commit bundle after the managed lint pass. Commit and push were completed with hook verification disabled after running the managed staged lint directly.

Copilot AI review requested due to automatic review settings May 23, 2026 19:47

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request upgrades the platform from PostgreSQL 17 to PostgreSQL 18. The changes include updating environment variables, Docker image tags, documentation, and the Dockerfile to reflect the new version. The AGE_VERSION is also updated to a compatible release candidate for PG18. Additionally, the upgrade script was enhanced with logic to automatically manage AGE_VERSION during major upgrades, and the test suite received several improvements, including better error reporting and refactored GraphQL schema definitions. Feedback was provided regarding the fallback logic in the _default_age_version_for_pg function to ensure safer version propagation for future PostgreSQL releases.

Comment thread scripts/lib/upgrade.sh Outdated
echo "PG17/v1.7.0-rc0"
;;
*)
echo "${AGE_VERSION:-master}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The fallback echo "${AGE_VERSION:-master}" in _default_age_version_for_pg may propagate an incompatible version string during a major upgrade to an unrecognized PostgreSQL version (e.g., PG19). Since this function is only invoked when the current AGE_VERSION is empty, "master", or pinned to an incorrect PG major, returning the current value as a fallback for an unknown PG version is suboptimal. Defaulting to master is safer for future-proofing until the script is updated for the next PG major.

Suggested change
echo "${AGE_VERSION:-master}"
echo "master"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the repository’s PostgreSQL stack defaults to PostgreSQL 18 (Debian Bookworm) and updates the related tooling/docs/CI so local workflows, published images, and the upgrade helper remain consistent with the new major version and Apache AGE pin.

Changes:

  • Bump default PostgreSQL version/tag references to PG18 (Dockerfile defaults, compose defaults, docs, CI).
  • Pin Apache AGE to the PG18-compatible PG18/v1.7.0-rc0 and update the upgrade helper to adjust AGE_VERSION when changing PostgreSQL majors.
  • Minor test harness improvements (GraphQL schema field thunks, endpoint resolver refactor, warnings instead of silent exception swallowing).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_manage.py Updates test harness schema definitions, endpoint factory, warning behavior, and upgrade test to target PG18.
scripts/lib/upgrade.sh Adds stricter bash settings and updates upgrade flow to bump AGE_VERSION when PG major changes.
README.md Refreshes top-level docs/examples to PostgreSQL 18.
postgres/initdb/00-render-config.sh Updates version-specific comment for PG18 configuration bounds.
postgres/Dockerfile Defaults build args to PG18, pins AGE ref, sets PGDATA, and avoids unversioned postgresql-contrib.
docs/RELEASING.md Updates release/tagging documentation examples to PG18.
docs/Initial_Concept.md Updates conceptual docs and env var examples to PG18/AGE pin.
docs/examples/ci-workflow.md Updates example CI workflow tag to PG18.
docker-compose.yml Updates default image tag to 18.4-bookworm-core.
ci.env.example Updates commented stack tag example to PG18.
CI_USAGE.md Updates documented default image tag to PG18.
CHANGELOG.md Updates initial release section and links for PG18 defaults and AGE pin.
.gitignore Adds coding-ethos runtime/cache artifacts to ignores.
.github/workflows/publish-docker.yml Updates publish metadata/defaults to PG18 and pins AGE ref based on PG major.
.github/workflows/ci.yml Updates CI defaults to PG18 and pins AGE ref.
.env.example Updates default PG_VERSION and AGE_VERSION to PG18.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/lib/upgrade.sh
Comment on lines +7 to +11
if [[ -z ${ROOT_DIR:-} ]]; then
LIB_UPGRADE_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=scripts/lib/common.sh
source "${LIB_UPGRADE_DIR}/common.sh"
fi
Comment thread tests/test_manage.py
Comment on lines +798 to 802
except OSError as exc:
warnings.warn(f"RabbitMQ management API check failed: {exc}", RuntimeWarning, stacklevel=2)
finally:
conn.close()
time.sleep(delay)
@paudley paudley self-assigned this May 23, 2026
@paudley
paudley marked this pull request as ready for review May 23, 2026 19:52
@paudley
paudley merged commit 5b988f3 into main May 23, 2026
4 checks passed
@paudley
paudley deleted the pg_18 branch May 23, 2026 19:55
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.

Upgrade PostgreSQL stack to PG18

2 participants