Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions HISTORY.asc
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
STABLE
------
== Add `print-pgtle` target for combined multi-extension pg_tle files
`make print-pgtle` prints the generated pg_tle registration SQL for each
extension to stdout, selecting the version directory from the new
`PGXNTOOL_PGTLE_TARGET_VERSION` variable (an actual pg_tle version, e.g.
`1.5.2`) or, if unset, the installed pg_tle version. This lets a consumer
build a combined multi-extension install file (e.g.
`$(MAKE) -C ../deps/cat_tools print-pgtle >> pgtle-all.sql`) without needing
to know the extension name or which `pg_tle/` version-range directory
applies. When invoking it recursively for stdout capture, pass
`--no-print-directory` -- otherwise GNU Make's own `Entering
directory`/`Leaving directory` announcements pollute the captured output.

Issues fixed in this release: #21

2.3.0
-----
== Rename `PGTLE_VERSION` to `PGXNTOOL_PGTLE_VERSION`
Expand Down
25 changes: 24 additions & 1 deletion README.asc
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,25 @@ After running `make run-pgtle`, you can create your extension in the database:
CREATE EXTENSION "your-extension-name";
----

=== print-pgtle
Prints the generated pg_tle registration SQL to stdout instead of running it, for consumers building a combined multi-extension install file. This target:
- Depends on `pgtle`, so the SQL files are (re)generated first
- Selects the version directory from `PGXNTOOL_PGTLE_TARGET_VERSION` if set (an actual pg_tle version like `1.5.2`, not a range like `PGXNTOOL_PGTLE_VERSION` uses), otherwise from the installed pg_tle version (queried the same way `run-pgtle` does)
- Errors if neither is available (no `PGXNTOOL_PGTLE_TARGET_VERSION` and pg_tle isn't installed)
- When invoked recursively (`$(MAKE) -C ... print-pgtle`) for stdout capture, pass `--no-print-directory` -- see warning below

----
make print-pgtle
make print-pgtle PGXNTOOL_PGTLE_TARGET_VERSION=1.5.2
----

A dependency's registration SQL can be pulled into a combined file without the caller needing to know its extension name or which `pg_tle/` version-range directory applies:
----
$(MAKE) --no-print-directory -C ../deps/cat_tools print-pgtle >> pgtle-all.sql
----

WARNING: Always pass `--no-print-directory` when invoking `print-pgtle` recursively from another Makefile's recipe (as above). GNU Make auto-prints `Entering directory`/`Leaving directory` announcements to stdout for recursive invocations, which silently corrupts a redirected combined SQL file with garbage lines. `--no-print-directory` suppresses them.

== Version-Specific SQL Files

PGXNtool automatically generates version-specific SQL files from your base SQL file. These files follow the pattern `sql/{extension}--{version}.sql` and are used by PostgreSQL's extension system to install specific versions of your extension.
Expand Down Expand Up @@ -554,7 +573,7 @@ PGXNtool appends *all* files found in all `$(DOC_DIRS)` to `DOCS`.
[[_pg_tle_Support]]
pgxntool can generate link:https://github.com/aws/pg_tle[pg_tle (Trusted Language Extensions)] registration SQL for deploying PostgreSQL extensions in managed environments like AWS RDS and Aurora where filesystem access is not available.

For make targets, see: <<_pgtle>>, <<_check_pgtle>>, <<_run_pgtle>>.
For make targets, see: <<_pgtle>>, <<_check_pgtle>>, <<_run_pgtle>>, <<_print_pgtle>>.

=== What is pg_tle?

Expand Down Expand Up @@ -686,6 +705,10 @@ Default: auto-detected, the first of `asciidoctor` or `asciidoc` found on `PATH`

Default: unset (generates every known pg_tle version range). Set on the command line to limit `make pgtle` to the single version range this value falls into. Not named `PGTLE_VERSION`: make auto-imports same-named environment variables, and that name collided silently with CI jobs that set a `PGTLE_VERSION` env var for an unrelated purpose (which pg_tle to test against). See <<_pgtle>>.

=== PGXNTOOL_PGTLE_TARGET_VERSION

Default: unset (falls back to the installed pg_tle version). Set on the command line to an actual pg_tle version (e.g. `1.5.2`, not a range) to select which `pg_tle/` directory `make print-pgtle` reads from, without needing a database connection. Distinct from `PGXNTOOL_PGTLE_VERSION`, which holds a range and controls generation rather than selection. See <<_print_pgtle>>.

=== PG_CONFIG

Default: `pg_config`. Path to the `pg_config` binary used to detect the PostgreSQL version and locate PGXS. Override when the right `pg_config` isn't the one on `PATH`, such as when testing against a specific PostgreSQL install.
Expand Down
Loading
Loading