Migrate zzz_build.sql to pgxntool's native test/build feature - #32
Merged
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
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.
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.
zzz_build.sqlhand-rolled exactly what pgxntool'stest/build/alreadydoes natively: run the raw install script directly via psql's
\i, insteadof via
CREATE EXTENSION.Postgres-Extensions/cat_toolsalready madethis exact move (its
test/build/build.sql).Why this matters, verified empirically (not assumed):
CREATE EXTENSIONgives 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:
vs.
Same gap for a runtime error (a bad relation reference, only resolved at
execution, not by parsing):
CREATE EXTENSIONstill just saysERROR: relation "..." does not existwith no file/line, while\ipinpoints the exact line and statement. This has not improved in modern
PostgreSQL -- the raw-
\i-via-test/build pattern is still worth keepingfor exactly the reason it originally existed.
Secondary fix, found along the way: the old
zzz_build.sqlneversuppressed
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/buildruns as its own separate
installcheckinvocation withclient_min_messages = WARNING(matching cat_tools's ownbuild.sqlpattern), so the expected output is now stable and empty.
PGXNTOOL_ENABLE_TEST_BUILDset explicitly (yes) rather than left toauto-detect, so an accidental future deletion of
test/build/'scontents becomes a hard error instead of the check silently vanishing.
Verified locally (PG17)
Both the main schedule (
schema,simple) and the newtest-buildtarget (
build) pass cleanly; confirmed the real captured output isempty/stable (no NOTICE noise), not just eyeballed. Separately verified
(scratch experiment, not part of this diff) that
CREATE EXTENSION'serror quality gap vs. raw
\istill holds on both PG12 and PG17 -- seeabove.
Stack position
Based directly on
master(independent of anything else) -- but #19(
test-install-foundation) toucheszzz_build.sql/zzz_build.outtoo and should rebase onto this once it lands, to inherit the cleanup
and drop its own now-unnecessary
DROP EXTENSION ... CASCADEworkaround(needed only because
test/install/load.sqlcollided with the oldsame-session
zzz_build.sqlapproach --test/buildruns in a fullyseparate session, so that workaround becomes moot).