Skip to content

feat: version the shared library filename#232

Merged
tjgreen42 merged 5 commits intomainfrom
versioned-binary
Feb 19, 2026
Merged

feat: version the shared library filename#232
tjgreen42 merged 5 commits intomainfrom
versioned-binary

Conversation

@tjgreen42
Copy link
Copy Markdown
Collaborator

@tjgreen42 tjgreen42 commented Feb 18, 2026

Summary

  • Shared library now includes the full semver version in its filename (e.g., pg_textsearch-1.0.0-dev.so), following the PostGIS model
  • Prevents DLL Hell when multiple versions are installed or when upgrading without restarting Postgres
  • Makefile extracts version from pg_textsearch.control and derives MODULE_big from it; make check-version validates consistency
  • Fixes CreateParallelContext to use a build-time PG_TEXTSEARCH_LIB_NAME macro instead of a hardcoded string, so parallel workers load the correct versioned binary

Changes

File What
Makefile Extract EXTVERSION, set MODULE_big, define PG_TEXTSEARCH_LIB_NAME, add check-version target
pg_textsearch.control Versioned module_pathname
src/am/build_parallel.c Use PG_TEXTSEARCH_LIB_NAME in CreateParallelContext
scripts/package-deb.sh Look for versioned .so
.github/workflows/{ci,release,package-release}.yml Reference versioned binary
RELEASING.md Document versioned binary scheme and version-bump workflow
CLAUDE.md Note versioned binary

Following the PostGIS model, the shared library now includes the full
semver version in its filename (e.g., pg_textsearch-1.0.0-dev.so).
This allows multiple versions to coexist in $libdir and prevents
undefined behavior when upgrading without restarting Postgres.

The Makefile extracts the version from pg_textsearch.control's
default_version and uses it to set MODULE_big. A new check-version
target validates that module_pathname is consistent.

Also fixes CreateParallelContext to use the versioned library name
via a build-time macro, so parallel index build workers load the
correct binary.
When upgrading from an unversioned binary (0.5.0) to a versioned one
(1.0.0-dev), the existing C functions still reference $libdir/pg_textsearch.
The upgrade script must recreate all functions with MODULE_PATHNAME so
their probin switches to $libdir/pg_textsearch-1.0.0-dev.

Also documents that future upgrade scripts must include function
recreation whenever the library version changes.
Upgrade scripts must use CREATE OR REPLACE FUNCTION to update probin
when the versioned library name changes. Ignore PS002 for upgrade
scripts (--*--*.sql) while keeping the check for install scripts.
@tjgreen42 tjgreen42 marked this pull request as ready for review February 18, 2026 18:51
@tjgreen42 tjgreen42 requested a review from cevian February 18, 2026 18:51
@cevian
Copy link
Copy Markdown

cevian commented Feb 19, 2026

This looks good except I'd make one suggestion: have one sql file that can serve as both a install and an upgrade script and that's idempotent. That way the upgrade is just a symlink to the one sql. You can handle idempotentcy in sql logic.

@tjgreen42
Copy link
Copy Markdown
Collaborator Author

This looks good except I'd make one suggestion: have one sql file that can serve as both a install and an upgrade script and that's idempotent. That way the upgrade is just a symlink to the one sql. You can handle idempotentcy in sql logic.

Let me think about this as a followup? I know we did this in pgvectorscale, but the sql gets a lot more complex, so I've shied away from it so far.

….2→0.5.0

- Add 0.5.0→0.5.1 and 0.5.1→1.0.0-dev upgrade scripts so users on
  v0.5.1 (patch release) can upgrade to 1.0.0-dev
- Add bm25_debug_pageviz() to 0.4.2→0.5.0 upgrade script — the
  function was added during the 0.5.0 cycle but the upgrade script
  was not updated
- Add v0.5.1 to upgrade-tests.yml matrix
@tjgreen42 tjgreen42 merged commit cedd81c into main Feb 19, 2026
32 checks passed
@tjgreen42 tjgreen42 deleted the versioned-binary branch February 19, 2026 17:04
tjgreen42 added a commit that referenced this pull request Feb 24, 2026
tjgreen42 added a commit that referenced this pull request Feb 24, 2026
## Summary

- Reverts #232 which added version numbers to the shared library
filename
- The versioned binary naming scheme (e.g.,
`pg_textsearch-1.0.0-dev.so`) caused problems in practice
- Returns to the standard unversioned `pg_textsearch.so` naming

## Testing

- `make installcheck` passes (all SQL regression + shell tests)
- `make format-check` passes
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