Extract versioned-SQL generation into sql.mk; install generated upgrade scripts (fixes #28)#32
Merged
jnasbyupgrade merged 1 commit intoJul 17, 2026
Conversation
|
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
jnasbyupgrade
force-pushed
the
fix-28-install-upgrade-scripts
branch
2 times, most recently
from
July 15, 2026 23:11
2136cb5 to
cb4c207
Compare
jnasbyupgrade
force-pushed
the
fix-28-install-upgrade-scripts
branch
from
July 15, 2026 23:18
cb4c207 to
077c091
Compare
jnasbyupgrade
force-pushed
the
fix-28-install-upgrade-scripts
branch
5 times, most recently
from
July 16, 2026 23:37
c6fd9e1 to
f2a194f
Compare
…de scripts (fixes Postgres-Extensions#28) The machinery that generates our versioned SQL (the cat_tools--X.Y.Z.sql install scripts and cat_tools--A.B.C--X.Y.Z.sql update scripts) from .sql.in sources, and the DATA list that installs it, is moved out of the Makefile into a new, documented sql.mk. sql.mk now OWNS `include pgxntool/base.mk` (at its top, so it can use EXTENSION_VERSION_FILES, PG_CONFIG, MAJORVER, datadir, ...); the Makefile just does `include sql.mk`. base.mk has no include guard, so it must be included exactly once -- see Postgres-Extensions/pgxntool#50. sql.mk documents the GNU Make two-phase (parse vs. recipe) hazard at the root of the bug: we GENERATE the .sql we install, the generated files are gitignored and absent on a clean tree at parse time, and any parse-time $(wildcard) over them (including base.mk's DATA seed $(wildcard sql/*--*--*.sql)) silently comes up short -- the cached directory listing means it never notices them later either. The fix is to name-derive the install/update lists from the .sql.in SOURCES (which DO exist at parse time), feed the generated names into DATA explicitly, and $(sort) to dedup against base.mk's own wildcard. This makes the generated upgrade scripts land in DATA reliably on a clean build, so `make install` copies them and a later `ALTER EXTENSION cat_tools UPDATE` finds its path. The historical cat_tools--0.1.* install list is no longer hardcoded: it is derived by globbing the committed install-shaped .sql and subtracting the update scripts and everything we generate from .sql.in. Globbing COMMITTED files at parse time is safe; the rule of thumb is glob what git tracks, name-derive what we generate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jnasbyupgrade
force-pushed
the
fix-28-install-upgrade-scripts
branch
from
July 17, 2026 00:01
36b6d71 to
bbb42ec
Compare
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.
What this is
Pure build-system refactor: moves the versioned-SQL generation machinery out of
Makefileinto a new, documentedsql.mk, and fixes #28 so generated update scripts reliably land inDATAon a clean build.What moved into
sql.mksql.mkowns the versioned-SQL machinery and doesinclude pgxntool/base.mkitself (theMakefilejustinclude sql.mk):versioned_in/versioned_out,upgrade_scripts_outhistorical_installs— the committedcat_tools--0.1.*list, derived by glob (subtracting update scripts + generated files) instead of hardcodedDATAhandling incl. the Clean-build 'make test' fails on all PG>=12: generated upgrade scripts excluded from DATA (parse-time wildcard) #28 fix (DATA += $(upgrade_scripts_out), thenDATA := $(sort $(DATA)))EXTENSION_VERSION_FILESrulesPlus a sql.mk cleanup: trimmed comments, dropped the
$Bindirection, removed the now-unneededsql/dir-creation rule.Why #28 happens
GNU Make is two-phase. The
.sqlwe install are generated and gitignored, so they're absent when the makefile is parsed — any parse-time$(wildcard)over them (including base.mk'sDATAseed) silently misses them, and Make's cached directory listing never picks them up later. So on a clean build the generated update scripts never reachDATA,make installskips them, and a laterALTER EXTENSION cat_tools UPDATEfails with "no update path". Fix: name-derive lists from the.sql.insources, feed generated names intoDATAexplicitly, and$(sort).Verification
On a clean tree the generated
0.2.0--0.2.1/0.2.0--0.2.2/0.2.1--0.2.2update scripts now appear inDATAandmake installcopies them (they didn't before).make print-DATAis byte-identical clean vs. fully-built.