Skip to content

Add make print-pgtle target for combined pg_tle install files - #94

Merged
jnasbyupgrade merged 2 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:issue-21-print-pgtle
Sep 8, 2026
Merged

Add make print-pgtle target for combined pg_tle install files#94
jnasbyupgrade merged 2 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:issue-21-print-pgtle

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a make print-pgtle target that prints the generated pg_tle registration SQL for each extension to stdout instead of running it, so a consumer can build a combined multi-extension install file:

$(MAKE) --no-print-directory -C ../deps/cat_tools print-pgtle >> pgtle-all.sql
  • Depends on pgtle (regenerates SQL first, like run-pgtle).
  • New PGXNTOOL_PGTLE_TARGET_VERSION variable (an actual pg_tle version like 1.5.2, not a range) selects the directory; falls back to the installed pg_tle version if unset.
  • Deliberately not named bare PGTLE_VERSION (would reopen the pgtle.sh: Makefile's PGTLE_VERSION variable silently collides with a consumer's same-named env var #78 collision) or reusing PGXNTOOL_PGTLE_VERSION (that holds a range, a different concept).
  • Documents a real footgun found while writing tests: GNU Make auto-prints Entering directory/Leaving directory to stdout on recursive invocation, corrupting a redirected combined file unless --no-print-directory is passed. Called out prominently in README.asc and base.mk.

Companion PR

pgxntool-test: Postgres-Extensions/pgxntool-test#73

Test plan

  • Full pgxntool-test suite (254/254, 0 failed, 0 skipped) passes with this branch paired against the companion test PR.

Fixes #21.

`print-pgtle` prints the generated pg_tle registration SQL for each
extension to stdout instead of running it, letting a consumer build a
combined multi-extension install file without needing to know the
extension name or which `pg_tle/` version-range directory applies:

    $(MAKE) --no-print-directory -C ../deps/cat_tools print-pgtle >> pgtle-all.sql

Depends on `pgtle` (regenerates SQL first, like `run-pgtle`). Selects
the directory via the new `PGXNTOOL_PGTLE_TARGET_VERSION` variable (an
actual pg_tle version like `1.5.2`) if set, otherwise via the installed
pg_tle version (same detection `run-pgtle` uses). Deliberately not
named bare `PGTLE_VERSION` or reusing `PGXNTOOL_PGTLE_VERSION`: the
former would reopen the issue Postgres-Extensions#78 collision with a CI job's env var of
that name, and the latter holds a range, not an exact version -- two
different concepts that would silently diverge if collapsed into one
variable.

`--no-print-directory` is required whenever this is invoked
recursively for stdout capture: GNU Make auto-prints "Entering
directory"/"Leaving directory" to stdout for recursive invocations,
which would otherwise corrupt the redirected file. Documented
prominently since it's easy to miss.

Documents the new target and variable in README.asc (+ regenerated
README.html).

Related changes in pgxntool-test:
- test/sequential/04-pgtle.bats: PGXNTOOL_PGTLE_TARGET_VERSION directory
  selection, non-collision with bare PGTLE_VERSION, and a regression
  test for the --no-print-directory requirement
- test/standard/pgtle-install.bats: DB-fallback and not-installed error
  path coverage

Fixes Postgres-Extensions#21.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 1, 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: Advanced

Run ID: 286abf12-e530-4d9a-a890-8e67e9e5818f

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.

@jnasbyupgrade
jnasbyupgrade marked this pull request as ready for review September 8, 2026 20:56
jnasbyupgrade added a commit to Postgres-Extensions/pgxntool-test that referenced this pull request Sep 8, 2026
Companion tests for pgxntool's new `make print-pgtle` target
(Postgres-Extensions/pgxntool#94).

- `test/sequential/04-pgtle.bats`: `PGXNTOOL_PGTLE_TARGET_VERSION`
selects and prints the matching `pg_tle/` directory's SQL exactly; an
older target version maps to the correct older range; a bare
`PGTLE_VERSION` env var does not leak into the new variable; a
regression test proving `--no-print-directory` is required to avoid GNU
Make's `Entering directory`/`Leaving directory` stdout pollution on
recursive invocation.
- `test/standard/pgtle-install.bats`: falls back to the installed pg_tle
version when no target version is set; errors cleanly when pg_tle isn't
installed and no target version is set.

## Companion PR

pgxntool: Postgres-Extensions/pgxntool#94
@jnasbyupgrade
jnasbyupgrade merged commit bedf9b6 into Postgres-Extensions:master Sep 8, 2026
5 checks passed
@jnasbyupgrade
jnasbyupgrade deleted the issue-21-print-pgtle branch September 8, 2026 20:59
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.

Add make print-pgtle target for version-aware pg_tle SQL output

1 participant