Summary
base.mk's DATA wildcard only picks up the current version file and upgrade-diff scripts — it silently skips historical full-install version scripts (sql/EXT--OLDVERSION.sql), even though these are meant to be tracked in git (per the .gitignore comment: "Version-specific files (sql/--.sql) are now tracked in git and should be committed").
# base.mk line 40
DATA = $(EXTENSION_VERSION_FILES) $(wildcard sql/*--*--*.sql)
$(wildcard sql/*--*--*.sql) requires two -- separators, matching upgrade scripts like count_nulls--0.9.6--1.0.0.sql. A historical full-install script like count_nulls--0.9.6.sql (one --) never matches, so make install never places it in $(datadir)/extension/, and CREATE EXTENSION count_nulls VERSION '0.9.6' fails with "extension control file ... does not exist" even though the script is present in sql/ and committed to git.
Why this matters now
pgxntool 2.1.0's new test-build feature (test/build/*.sql, auto-run via pg_regress) is the natural place to put an "install old version, then ALTER EXTENSION ... UPDATE" sanity test. That pattern requires the old version's full install script to actually be installed — which this wildcard gap prevents by default.
Two independent extensions have hit this and needed the identical manual workaround in their own Makefile:
Suggested fix
Broaden the wildcard to also pick up single--- historical version files, e.g.:
DATA = $(EXTENSION_VERSION_FILES) $(wildcard sql/*--*.sql)
(sql/*--*.sql already covers both the two-dash upgrade scripts and the one-dash historical full-install scripts; EXTENSION_VERSION_FILES — the current version — would just be redundantly matched by the wildcard too, which is harmless.)
If that's too broad for some project shapes, an alternative is documenting the DATA += workaround explicitly in CLAUDE.md/README.asc under the test-build section, so extensions don't have to rediscover it via a failing test.
Repro
- Any extension with a historical full-install script for a version older than current (e.g.
sql/count_nulls--0.9.6.sql, current default is 1.0.0).
make install (without adding it to DATA manually).
psql -c "CREATE EXTENSION count_nulls VERSION '0.9.6'" → fails, file not found in the extension directory.
Summary
base.mk'sDATAwildcard only picks up the current version file and upgrade-diff scripts — it silently skips historical full-install version scripts (sql/EXT--OLDVERSION.sql), even though these are meant to be tracked in git (per the.gitignorecomment: "Version-specific files (sql/--.sql) are now tracked in git and should be committed").$(wildcard sql/*--*--*.sql)requires two--separators, matching upgrade scripts likecount_nulls--0.9.6--1.0.0.sql. A historical full-install script likecount_nulls--0.9.6.sql(one--) never matches, somake installnever places it in$(datadir)/extension/, andCREATE EXTENSION count_nulls VERSION '0.9.6'fails with "extension control file ... does not exist" even though the script is present insql/and committed to git.Why this matters now
pgxntool 2.1.0's new
test-buildfeature (test/build/*.sql, auto-run via pg_regress) is the natural place to put an "install old version, thenALTER EXTENSION ... UPDATE" sanity test. That pattern requires the old version's full install script to actually be installed — which this wildcard gap prevents by default.Two independent extensions have hit this and needed the identical manual workaround in their own
Makefile:DATA += sql/cat_tools--0.2.1.sqlDATA += sql/count_nulls--0.9.6.sqlSuggested fix
Broaden the wildcard to also pick up single-
--historical version files, e.g.:(
sql/*--*.sqlalready covers both the two-dash upgrade scripts and the one-dash historical full-install scripts;EXTENSION_VERSION_FILES— the current version — would just be redundantly matched by the wildcard too, which is harmless.)If that's too broad for some project shapes, an alternative is documenting the
DATA +=workaround explicitly inCLAUDE.md/README.ascunder thetest-buildsection, so extensions don't have to rediscover it via a failing test.Repro
sql/count_nulls--0.9.6.sql, current default is1.0.0).make install(without adding it toDATAmanually).psql -c "CREATE EXTENSION count_nulls VERSION '0.9.6'"→ fails, file not found in the extension directory.