diff --git a/HISTORY.asc b/HISTORY.asc index 9b59bc4..1064b88 100644 --- a/HISTORY.asc +++ b/HISTORY.asc @@ -1,5 +1,13 @@ STABLE ------ +== Fix `DATA` wildcard skipping historical full-install version scripts +`base.mk`'s `DATA` wildcard (`sql/*--*--*.sql`) only matched upgrade scripts +(two `--` separators), silently skipping historical full-install scripts +like `sql/ext--0.9.6.sql` (one `--`) even though these are meant to be +committed to git. `make install` never placed them in the extension +directory, so `CREATE EXTENSION ext VERSION 'x.y.z'` failed for any version +older than current. Widened to `sql/*--*.sql`, which matches both. + == Rename `PGTLE_VERSION` to `PGXNTOOL_PGTLE_VERSION` `make pgtle`'s version-limiting variable was named `PGTLE_VERSION`, which make auto-imports from an identically-named environment variable. That name @@ -15,7 +23,7 @@ regardless of `pg_regress`'s exit status, and `test`'s recipe only `cat`ed `regression.diffs` for visibility without checking it. `make test` now exits non-zero when `regression.diffs` is non-empty, after printing it. -Issues fixed in this release: #35, #49, #78, #79 +Issues fixed in this release: #35, #49, #78, #79, #48 2.2.0 ----- diff --git a/README.asc b/README.asc index 2246791..4159bd9 100644 --- a/README.asc +++ b/README.asc @@ -457,6 +457,21 @@ If you need to support multiple versions of your extension: The version file for the current version (specified in the `.control` file's `default_version`) will be automatically regenerated when you run `make`, but other version files you create manually will be preserved. +=== Gotchas + +==== Generated SQL Files Can Be Missed on a Clean Build + +`DATA` (the PGXS variable controlling what `make install` actually installs) is seeded by pgxntool with `$(wildcard sql/*--*.sql)`, so PGXS installs whatever version-specific and upgrade files exist under `sql/` when `DATA` is evaluated. + +If your extension *generates* its versioned SQL from another source (e.g. a `.sql.in` template expanded by a custom rule) and gitignores the generated `.sql`, a clean `make install` (or `make test`, `make all install` in one invocation) can silently omit files that were only just generated during that same run. This isn't a pattern-matching problem — the glob is correct — it's a GNU Make quirk: `wildcard` caches a directory's contents internally for the life of one `make` invocation, and that cache isn't invalidated just because a recipe created new files earlier in the same run. So even though `DATA` is a recursively-expanded variable (re-evaluated each time it's referenced), re-referencing it later in the same invocation can still see the stale, pre-generation listing. + +Workarounds: + +- Run generation and install as separate `make` invocations (e.g. `make && make install`) so the second invocation's parse-time wildcard scan sees files the first invocation created. +- List the generated files in `DATA` explicitly, keyed off stable names derived from your `.sql.in` sources (known at parse time) rather than relying on `wildcard` to discover the generated `.sql` output. + +Tracked as https://github.com/Postgres-Extensions/pgxntool/issues/44[issue #44] — pgxntool doesn't yet have first-class support for generated versioned SQL; the ideas under discussion there (e.g. a dedicated generated-output directory pgxntool builds before installing) are a bigger design change than a one-line fix. + == Document Handling PGXNtool supports generation and installation of document files. There are several variables and rules that control this behavior. diff --git a/README.html b/README.html index 576cdc6..ba71c2a 100644 --- a/README.html +++ b/README.html @@ -475,6 +475,7 @@

PGXNtool

  • 5.5. Alternative: Ignoring All Version Files
  • 5.6. Distribution Inclusion
  • 5.7. Multiple Versions
  • +
  • 5.8. Gotchas
  • 6. Document Handling @@ -1481,6 +1482,34 @@

    The version file for the current version (specified in the .control file’s default_version) will be automatically regenerated when you run make, but other version files you create manually will be preserved.

    +
    +

    5.8. Gotchas

    +
    +

    5.8.1. Generated SQL Files Can Be Missed on a Clean Build

    +
    +

    DATA (the PGXS variable controlling what make install actually installs) is seeded by pgxntool with $(wildcard sql/--.sql), so PGXS installs whatever version-specific and upgrade files exist under sql/ when DATA is evaluated.

    +
    +
    +

    If your extension generates its versioned SQL from another source (e.g. a .sql.in template expanded by a custom rule) and gitignores the generated .sql, a clean make install (or make test, make all install in one invocation) can silently omit files that were only just generated during that same run. This isn’t a pattern-matching problem — the glob is correct — it’s a GNU Make quirk: wildcard caches a directory’s contents internally for the life of one make invocation, and that cache isn’t invalidated just because a recipe created new files earlier in the same run. So even though DATA is a recursively-expanded variable (re-evaluated each time it’s referenced), re-referencing it later in the same invocation can still see the stale, pre-generation listing.

    +
    +
    +

    Workarounds:

    +
    +
    +
      +
    • +

      Run generation and install as separate make invocations (e.g. make && make install) so the second invocation’s parse-time wildcard scan sees files the first invocation created.

      +
    • +
    • +

      List the generated files in DATA explicitly, keyed off stable names derived from your .sql.in sources (known at parse time) rather than relying on wildcard to discover the generated .sql output.

      +
    • +
    +
    +
    +

    Tracked as issue #44 — pgxntool doesn’t yet have first-class support for generated versioned SQL; the ideas under discussion there (e.g. a dedicated generated-output directory pgxntool builds before installing) are a bigger design change than a one-line fix.

    +
    +
    +