Include Postgres 18 in wheel as default, with upgrade script from Postgres 16 to 18 - #23
Merged
Merged
Conversation
There was a problem hiding this comment.
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 retainingpginstallas Postgres 16 for upgrade support. - Add
upgrade_db()(plus helpers) and extendpgexec()to support executing commands from a specified Postgresbindirectory. - 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_instancesbefore initialization completes. Ifensure_pgdata_inited()/ensure_postgres_running()raises, the cache can retain a partially-initialized server and subsequentget_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 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.""" |
pierrebrunelle
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.