Skip to content

Include Postgres 18 in wheel as default, with upgrade script from Postgres 16 to 18 - #23

Merged
aaron-siegel merged 13 commits into
pixeltable:mainfrom
aaron-siegel:postgres18
Jul 14, 2026
Merged

Include Postgres 18 in wheel as default, with upgrade script from Postgres 16 to 18#23
aaron-siegel merged 13 commits into
pixeltable:mainfrom
aaron-siegel:postgres18

Conversation

@aaron-siegel

Copy link
Copy Markdown
Collaborator

No description provided.

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.

Pull request overview

This PR updates pixeltable_pgserver to ship Postgres 18 binaries as the default embedded server while keeping Postgres 16 binaries available for in-place data directory upgrades.

Changes:

  • Switch default embedded Postgres binary path to pginstall18, while retaining pginstall as Postgres 16 for upgrade support.
  • Add upgrade_db() (plus helpers) and extend pgexec() to support executing commands from a specified Postgres bin directory.
  • Update build/packaging (Makefiles, MANIFEST, workflow cache) to build and include both Postgres 16 and 18 installs, and bump pgvector.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/pixeltable_pgserver/utils.py Switch default Postgres bin path to 18; add explicit Postgres 16 bin path constant.
src/pixeltable_pgserver/postgres_server.py Add upgrade helpers and upgrade_db(); refactor startup into start(); add Postgres 16 permission handling.
src/pixeltable_pgserver/pgexec.py Add bin_path parameter to run commands against Postgres 16 vs 18 binaries.
src/pixeltable_pgserver/init.py Export upgrade helper functions at package top level.
pyproject.toml Adjust optional dependencies and mypy config.
pgbuild/Makefile Parameterize install location/version; bump pgvector; broaden clean rule.
MANIFEST.in Include both pginstall and pginstall18 in sdist.
Makefile Build both Postgres 16 and 18 installs; force wheel reinstall.
.gitignore Ignore pginstall* and common local/editor artifacts.
.github/workflows/build-and-test.yml Cache both pginstall and pginstall18 build outputs.
Comments suppressed due to low confidence (1)

src/pixeltable_pgserver/postgres_server.py:86

  • start() adds the instance to _instances before initialization completes. If ensure_pgdata_inited()/ensure_postgres_running() raises, the cache can retain a partially-initialized server and subsequent get_server() calls will return it without retrying startup.
    def start(self) -> None:
        atexit.register(self._cleanup)
        with self._lock:
            self._instances[self.pgdata] = self
            self.ensure_pgdata_inited()
            self.ensure_postgres_running()
            self.global_process_id_list.get_and_add(os.getpid())


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

Comment thread src/pixeltable_pgserver/postgres_server.py Outdated
Comment thread src/pixeltable_pgserver/postgres_server.py Outdated
Comment thread src/pixeltable_pgserver/postgres_server.py Outdated
Comment on lines +380 to +386
old_server = get_server(pgdata, start=False)
with old_server._lock:
postmaster_info = PostmasterInfo.read_from_pgdata(pgdata)
if postmaster_info is not None and postmaster_info.is_running():
print('Stopping existing pgserver: %s', postmaster_info)
pgexec('pg_ctl', ('-D', str(pgdata), 'stop'), bin_path=POSTGRES_16_BIN_PATH, user=old_server.system_user)

Comment on lines +311 to +339
@@ -321,4 +333,102 @@ def get_server(pgdata: Path | str, cleanup_mode: str | None = 'stop') -> Postgre
if pgdata in PostgresServer._instances:
return PostgresServer._instances[pgdata]

return PostgresServer(pgdata, cleanup_mode=cleanup_mode)
server = PostgresServer(pgdata, cleanup_mode=cleanup_mode)
if start:
server.start()
return server
current_version = pgdata_version(pgdata)
if current_version is None or current_version == target_version:
# Nothing to do
return None
Comment on lines +362 to +363
def upgrade_db(pgdata: Path | str) -> None:
"""Upgrades the given pgdata directory to the installed version of postgres."""
@aaron-siegel aaron-siegel changed the title Include Postgres 18 in wheel as default, with automated upgrade script from Postgres 16 to 18 Include Postgres 18 in wheel as default, with upgrade script from Postgres 16 to 18 Jul 14, 2026
@aaron-siegel
aaron-siegel merged commit bb0cf09 into pixeltable:main Jul 14, 2026
6 checks passed
@aaron-siegel
aaron-siegel deleted the postgres18 branch July 14, 2026 15:30
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.

3 participants