Skip to content

Migrate zzz_build.sql to pgxntool's native test/build feature - #32

Merged
jnasbyupgrade merged 3 commits into
masterfrom
migrate-test-build
Aug 7, 2026
Merged

Migrate zzz_build.sql to pgxntool's native test/build feature#32
jnasbyupgrade merged 3 commits into
masterfrom
migrate-test-build

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

zzz_build.sql hand-rolled exactly what pgxntool's test/build/ already
does natively: run the raw install script directly via psql's \i, instead
of via CREATE EXTENSION. Postgres-Extensions/cat_tools already made
this exact move (its test/build/build.sql).

Why this matters, verified empirically (not assumed): CREATE EXTENSION
gives genuinely poor error output when the install script has a bug --
no source file, no line number, no snippet of the failing statement, for
either a syntax error or a runtime/semantic one (e.g. a bad table
reference only caught at execution). Confirmed on both PG12 and PG17,
identical on both:

$ CREATE EXTENSION extdrop_synerr;
ERROR:  syntax error at or near "sql"

vs.

$ \i broken_syntax.sql
psql:broken_syntax.sql:112: ERROR:  syntax error at or near "sql"
LINE 3:   sql text NOT NULL
          ^

Same gap for a runtime error (a bad relation reference, only resolved at
execution, not by parsing): CREATE EXTENSION still just says
ERROR: relation "..." does not exist with no file/line, while \i
pinpoints the exact line and statement. This has not improved in modern
PostgreSQL -- the raw-\i-via-test/build pattern is still worth keeping
for exactly the reason it originally existed.

Secondary fix, found along the way: the old zzz_build.sql never
suppressed client_min_messages, so its expected output captured verbose,
PG-minor-version-dependent NOTICEs (e.g. "%TYPE converted to ..." with a
source-file LOCATION line) -- any environment/PG-version drift showed as
a spurious diff. This is the exact noise seen repeatedly (harmlessly,
since CI doesn't gate on it) elsewhere in this repo's history. test/build
runs as its own separate installcheck invocation with
client_min_messages = WARNING (matching cat_tools's own build.sql
pattern), so the expected output is now stable and empty.

PGXNTOOL_ENABLE_TEST_BUILD set explicitly (yes) rather than left to
auto-detect, so an accidental future deletion of test/build/'s
contents becomes a hard error instead of the check silently vanishing.

Verified locally (PG17)

Both the main schedule (schema, simple) and the new test-build
target (build) pass cleanly; confirmed the real captured output is
empty/stable (no NOTICE noise), not just eyeballed. Separately verified
(scratch experiment, not part of this diff) that CREATE EXTENSION's
error quality gap vs. raw \i still holds on both PG12 and PG17 -- see
above.

Stack position

Based directly on master (independent of anything else) -- but #19
(test-install-foundation) touches zzz_build.sql/zzz_build.out
too and should rebase onto this once it lands, to inherit the cleanup
and drop its own now-unnecessary DROP EXTENSION ... CASCADE workaround
(needed only because test/install/load.sql collided with the old
same-session zzz_build.sql approach -- test/build runs in a fully
separate session, so that workaround becomes moot).

zzz_build.sql hand-rolled exactly what pgxntool's test/build/ already
does natively: run the raw install script directly (not via CREATE
EXTENSION) for better error messages than a bare CREATE EXTENSION
failure. Postgres-Extensions/cat_tools already made this exact move.

Also fixes the flaky expected-output problem that came with the old
approach: zzz_build.sql ran client_min_messages unsuppressed, so its
expected output captured verbose, PG-minor-version-dependent NOTICEs
(e.g. "%TYPE converted to ..." with a source-file LOCATION line) --
any environment/PG-version drift showed as a spurious diff. test/build
runs as its own separate installcheck invocation with
client_min_messages = WARNING (matching cat_tools's own build.sql),
so the expected output is stable and empty.

PGXNTOOL_ENABLE_TEST_BUILD set explicitly (yes) rather than left to
auto-detect, so an accidental future deletion of test/build/'s
contents is a hard error instead of the check silently vanishing.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1c22c459-f563-435e-a614-efa725740900

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

The dependency-install comment used stacked -- lines while the
NOTICE-suppression comment right below it uses a /* */ block; make
them consistent, and drop the confusing "not \i --" line that read
like a nested comment marker.
@jnasbyupgrade
jnasbyupgrade merged commit 67fe0a4 into master Aug 7, 2026
10 checks passed
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.

1 participant