-
-
Notifications
You must be signed in to change notification settings - Fork 226
feat: support multiple versions of the pg_tap extension #1678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
hunleyd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase to fix conflicts?
a6eec87 to
927dcdd
Compare
927dcdd to
8590eec
Compare
8590eec to
d4d66ed
Compare
d4d66ed to
8590eec
Compare
8590eec to
635b87a
Compare
8811cbc to
30c969d
Compare
30c969d to
ec034dc
Compare
Build multiple versions of the pg_tap extension on different PostgreSQL versions. Add test for the extensions and their upgrade on PostgreSQL 15 and 17.
And run pg_regress tests for pgtap as part of the unified extension tests
ec034dc to
f746eec
Compare
WalkthroughReplaces the single-derivation pgtap export with a buildEnv-based multi-version factory driven by Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@nix/ext/pgtap.nix`:
- Around line 66-69: The sed invocation is using an undefined shell variable
`$ext`, so `module_pathname` will be wrong; fix by defining `ext` (e.g., set ext
to the correct shared-object path) before the sed call or replace `$ext` inline
with the correct path expression, and if the package may not build a C
extension, change the logic around `${pname}.control` generation (in the block
that runs sed and touches `${pname}--${version}.control`) to conditionally omit
the `module_pathname` line when `src/pgtap.so` (or the built shared object) does
not exist.
🧹 Nitpick comments (1)
nix/ext/pgtap.nix (1)
86-89: Hardcoded version check for C extension symlink.The condition
"${version}" == "1.3.1"is hardcoded. If a future pgtap version reintroduces a C extension, this logic won't automatically handle it. Consider documenting this decision or making the check more robust (e.g., based on whether the .so file exists and this is not the latest version).♻️ Alternative approach
- elif [[ "${version}" == "1.3.1" ]]; then - # 1.3.1 is the first and only version with a C extension - ln -sfn ${pname}-${version}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix} + elif [[ -f src/pgtap.so && "${version}" != "${latestVersion}" ]]; then + # Create default symlink for non-latest versions with C extension + ln -sfn ${pname}-${version}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix} fi
Define the ext variable to point to the correct shared library path before using it in the sed command that sets module_pathname in the PostgreSQL extension control file.
… detection
Check for src/pgtap${postgresql.dlSuffix} instead of hardcoded src/pgtap.so
to properly detect the shared library on all platforms (e.g., .dylib on macOS).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@nix/ext/pgtap.nix`:
- Around line 9-29: Add a guard after computing supportedVersions/versions to
fail with a clear message when no matching entries exist: compute versions as
you do, then compute numberOfVersions (or use builtins.length versions) and use
lib.assert (or an explicit check) to ensure numberOfVersions > 0, failing with a
message that includes the current postgresql.version; this prevents lib.last
(latestVersion) from being called on an empty list and makes the error explicit.
- Around line 66-90: The control-file rewrite currently unconditionally replaces
module_pathname (using ext) which can point to a missing shared library for
SQL-only releases; change the logic so the sed rewrite that sets module_pathname
to $ext only runs when the shared library exists (the same test used for
src/pgtap${postgresql.dlSuffix}), and for SQL-only versions remove the
module_pathname line entirely (or leave it omitted) from the generated
${pname}--${version}.control so CREATE EXTENSION won't reference a non-existent
library.
…name - Add assertion guard to fail clearly when no supported versions exist for the current PostgreSQL version, preventing lib.last on empty list - Gate module_pathname rewrite on shared library existence: only set module_pathname when the shared library exists, remove the line entirely for SQL-only versions to prevent CREATE EXTENSION failures
Build multiple versions of the pg_tap extension on different PostgreSQL versions.
Add test for the extensions and their upgrade on PostgreSQL 15 and 17.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.