Skip to content

Conversation

@jfroche
Copy link
Collaborator

@jfroche jfroche commented Nov 14, 2025

Summary by CodeRabbit

  • New Features

    • Multi-version packaging for the supautils extension (per-version builds, latest-version symlink) with PostgreSQL 15 and 17 support; version metadata added and exposed.
  • Tests

    • Integration test covering install, migration (15→17) and end-to-end verification.
    • SQL regression tests validating extension behavior on PostgreSQL 15 and 17.
  • Chores

    • Exposed additional passthru metadata (versions, counts, installed extensions, withPackages helper, default settings).

@jfroche jfroche force-pushed the multi-version-ext/supautils branch 2 times, most recently from aa1ed62 to 848d4b2 Compare November 17, 2025 14:44
@jfroche jfroche marked this pull request as ready for review November 17, 2025 14:54
@jfroche jfroche requested review from a team as code owners November 17, 2025 14:54
@jfroche jfroche force-pushed the multi-version-ext/supautils branch from 848d4b2 to d6ffec1 Compare December 9, 2025 15:49
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Replaces a single-version stdenv build for the supautils extension with a multi-version packaging approach driven by nix/ext/versions.json. Adds per-version fetch-and-build logic that installs versioned shared libraries and per-version PostgreSQL control files, creates a latest-version symlink and default control file, and exposes version metadata via passthru. Adds a Nix integration test exercising PostgreSQL 15→17 migration with systemd orchestration and pg_regress checks, SQL regress tests for 15 and 17, and passthru plumbing for postgres packages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

extensions, tests, nix

Suggested reviewers

  • samrose
  • soedirgo
  • hunleyd
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, despite a template being available for this repository that suggests either 'Default' or 'Extension Upgrade' templates should be used. Add a comprehensive PR description using the appropriate template (likely 'Extension Upgrade') explaining the changes, motivation, testing, and any breaking changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: adding multi-version support for the supautils extension across the Nix configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch multi-version-ext/supautils

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@blacksmith-sh

This comment has been minimized.

@yvan-sraka yvan-sraka self-assigned this Jan 20, 2026
@yvan-sraka yvan-sraka requested a review from samrose January 20, 2026 16:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/supautils.nix`:
- Around line 41-55: The installPhase currently writes the control file but
fails to install upstream SQL migration scripts, so add steps in installPhase to
copy the extension SQL files (e.g., supautils--*.sql and any
supautils--*.sql.gz) from the build/source directory (likely src/) into
$out/share/postgresql/extension/ alongside the control file; ensure files
include the versioned filenames that match ${pname}--${version}.sql and any
default_version.sql if present, and keep the existing mv of the shared library
and the control file creation intact (refer to installPhase, ${pname},
${version}, and the $out/share/postgresql/extension destination).
🧹 Nitpick comments (1)
nix/ext/tests/supautils.nix (1)

48-61: Avoid double-wrapping psql_15 in postgresqlWithExtension.

psql_15 is already produced by postgresqlWithExtension (Line 39), so wrapping again at Line 50 is redundant and differs from the PG17 branch. Consider using package = psql_15; for consistency.

♻️ Suggested change
-        package = (postgresqlWithExtension psql_15);
+        package = psql_15;

Comment on lines +41 to +55
installPhase = ''
runHook preInstall

mkdir -p $out/{lib,share/postgresql/extension}

# Install shared library with version suffix
mv ${pname}${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix}

# Create version-specific control file
cat <<EOF > $out/share/postgresql/extension/${pname}--${version}.control
module_pathname = '$libdir/supautils'
relocatable = false
EOF

runHook postInstall
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, explore the file structure to understand the context
find . -type f -name "*.nix" | head -20

Repository: supabase/postgres

Length of output: 563


🏁 Script executed:

# Read the full supautils.nix file to understand the build context
wc -l nix/ext/supautils.nix

Repository: supabase/postgres

Length of output: 85


🏁 Script executed:

# Check if there are SQL files in the repository
find . -type f -name "*.sql" | grep -i supabase

Repository: supabase/postgres

Length of output: 701


🏁 Script executed:

# Search for upstream source definition in supautils.nix
cat nix/ext/supautils.nix

Repository: supabase/postgres

Length of output: 2861


🏁 Script executed:

# Search for any references to supautils SQL or control files in the codebase
rg -i "supautils\.(control|sql)" --type nix

Repository: supabase/postgres

Length of output: 43


🏁 Script executed:

# Check if there's any documentation or references about supautils extension structure
rg -i "supautils" --type md | head -20

Repository: supabase/postgres

Length of output: 1212


🌐 Web query:

supautils PostgreSQL extension GitHub supabase repository structure SQL files

💡 Result:

supabase/supautils repo — summary (where the PostgreSQL extension SQL lives)

  • Repo root: contains README.md, Makefile, META.json, LICENSE and top-level dirs .github/, nix/, src/, test/. [1]
  • PostgreSQL extension source (C/SQL and extension metadata) is in the src/ directory — that is where the extension build installs the SQL control/script files used by CREATE EXTENSION. [1]
  • Docs / overview (features, install, config keys) are in README.md on the repo front page. [1]

Source:
[1] supabase/supautils (GitHub repository) — repository file listing and README.


🏁 Script executed:

# Check versions.json to understand what versions are being built
cat nix/ext/versions.json | rg -A 5 "supautils"

Repository: supabase/postgres

Length of output: 150


🏁 Script executed:

# Look at how other extensions handle SQL files and control files
cat nix/ext/pg_net.nix | head -80

Repository: supabase/postgres

Length of output: 2320


🏁 Script executed:

# Check if there are any SQL files mentioned in the extension builds
rg "\.sql" nix/ext/*.nix | head -20

Repository: supabase/postgres

Length of output: 1963


🏁 Script executed:

# Let me check the documentation about supautils updates to understand the structure
cat nix/docs/update-extension.md

Repository: supabase/postgres

Length of output: 7041


🏁 Script executed:

# Look at what pg_graphql does since it's also from supabase
head -100 nix/ext/pg_graphql/default.nix | tail -60

Repository: supabase/postgres

Length of output: 2423


🏁 Script executed:

# Check if the postBuild in supautils actually handles the versioning correctly
# by looking at the full flow - does it properly create default_version?
sed -n '64,88p' nix/ext/supautils.nix

Repository: supabase/postgres

Length of output: 742


🌐 Web query:

site:github.com supabase/supautils repository structure src control.in

💡 Result:

The supabase/supautils repository has a top-level src/ directory, but there is no file named control.in in that repository tree (no matching file found). [1][2]

Sources:

  • supabase/supautils repository (shows src/ at top level). [1]
  • supabase/supautils — src/ tree view (no control.in file present). [2]

🏁 Script executed:

# Check if there are any comments in the supautils.nix that explain why SQL files aren't copied
grep -B5 -A5 "control file" nix/ext/supautils.nix

Repository: supabase/postgres

Length of output: 985


🏁 Script executed:

# Look at how pg_graphql (also a Supabase pgrx extension) handles control files for reference
grep -A10 "postInstall" nix/ext/pg_graphql/default.nix | head -30

Repository: supabase/postgres

Length of output: 593


🏁 Script executed:

# Search for any SQL-related patterns in nix files that might indicate what extensions typically need
rg "sql.*\.sql" nix/ext/ --type nix | grep -i "supautils|pg_net|vault" | head -20

Repository: supabase/postgres

Length of output: 43


🌐 Web query:

supautils PostgreSQL extension Rust C source code SQL migration files

💡 Result:

You can find the supautils source and SQL files on the project’s GitHub repo:

Additional package/extension metadata pages:

  • Trunk package info for supautils. [2]
  • Pigsty package metadata (versions for multiple PG releases). [3]

If you want I can list or show specific files (e.g., src/*.c, extension control/SQL files) from the repo — tell me which files or paths you want.


🏁 Script executed:

# Check if there's a Makefile or build-related file that shows what supautils builds
# Since we can see it's fetched from GitHub, the typical structure would have src files
# Let's check if there's any documentation about what supautils provides
grep -r "supautils" nix/docs/ -A 3 -B 3

Repository: supabase/postgres

Length of output: 2153


Install upstream SQL migration files during installPhase.

The current installPhase creates a minimal control file but does not copy SQL migration scripts (e.g., supautils--*.sql files) from the upstream source. Unlike the default_version (which is correctly added in postBuild), missing SQL files will cause CREATE EXTENSION and upgrade operations to fail. Other extensions in this repo (pg_net, vault, pg_graphql, etc.) consistently copy these files. If the upstream supautils repository ships migration scripts in its src/ directory, they must be installed alongside the compiled library.

🤖 Prompt for AI Agents
In `@nix/ext/supautils.nix` around lines 41 - 55, The installPhase currently
writes the control file but fails to install upstream SQL migration scripts, so
add steps in installPhase to copy the extension SQL files (e.g.,
supautils--*.sql and any supautils--*.sql.gz) from the build/source directory
(likely src/) into $out/share/postgresql/extension/ alongside the control file;
ensure files include the versioned filenames that match ${pname}--${version}.sql
and any default_version.sql if present, and keep the existing mv of the shared
library and the control file creation intact (refer to installPhase, ${pname},
${version}, and the $out/share/postgresql/extension destination).

jfroche and others added 2 commits February 3, 2026 20:38
…ompatibility

The newer NixOS PostgreSQL service module requires these attributes but our custom PostgreSQL packages weren't providing them, causing CI failures.
@yvan-sraka yvan-sraka force-pushed the multi-version-ext/supautils branch from e9a6ccc to ee472c2 Compare February 3, 2026 19:38
@yvan-sraka yvan-sraka removed their assignment Feb 5, 2026
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