Skip to content
Merged
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
7 changes: 7 additions & 0 deletions HISTORY.asc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ Install files now always run in byte-value (ASCII) filename order,
regardless of filesystem or locale. If one install file depends on another,
encode that in the filenames (e.g. a numeric prefix); see README.

== `PGXNTOOL_PGTLE_VERSION` must be an exact pg_tle range name
`make pgtle PGXNTOOL_PGTLE_VERSION=...` (and `pgtle.sh --pgtle-version`) now
errors unless the value is exactly `1.0.0-1.4.0`, `1.4.0-1.5.0` or `1.5.0+`.
A plain pg_tle version such as `1.5.0` used to be accepted silently,
generating a bogus `pg_tle/1.5.0/` directory; the error now names the range
it belongs to (`did you mean 1.5.0+?`).

Issues fixed in this release: #20, #21, #55, #87, #90, #97, #108, #111, #115, #119

2.3.0
Expand Down
4 changes: 2 additions & 2 deletions README.asc
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ Set `PGXNTOOL_PGTLE_VERSION` on the command line to a range name (`1.0.0-1.4.0`,
make pgtle PGXNTOOL_PGTLE_VERSION=1.5.0+
----

The value must be one of those range names exactly; it is not mapped from a plain pg_tle version. Any other value (e.g. `1.5.0`) is not validated and produces a bogus `pg_tle/1.5.0/` directory.
The value must be one of those range names exactly; it is not mapped from a plain pg_tle version. Any other value is rejected with an error listing the valid ranges; for a plain pg_tle version (e.g. `1.5.0`), the error also names the range it falls in.

=== check-pgtle
Checks if pg_tle is installed and reports the version. This target:
Expand Down Expand Up @@ -766,7 +766,7 @@ Default: auto-detected, the first of `asciidoctor` or `asciidoc` found on `PATH`

=== PGXNTOOL_PGTLE_VERSION

Default: unset (generates every known pg_tle version range). Set on the command line to a range name (`1.0.0-1.4.0`, `1.4.0-1.5.0` or `1.5.0+`, exactly) to limit `make pgtle` to that one range; any other value is passed through unvalidated and generates a bogus `pg_tle/<value>/` directory. 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>>.
Default: unset (generates every known pg_tle version range). Set on the command line to a range name (`1.0.0-1.4.0`, `1.4.0-1.5.0` or `1.5.0+`, exactly) to limit `make pgtle` to that one range; any other value is rejected with an error. 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

Expand Down
6 changes: 3 additions & 3 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ <h3 id="_pgtle"><a class="anchor" href="#_pgtle"></a><a class="link" href="#_pgt
</div>
</div>
<div class="paragraph">
<p>The value must be one of those range names exactly; it is not mapped from a plain pg_tle version. Any other value (e.g. <code>1.5.0</code>) is not validated and produces a bogus <code>pg_tle/1.5.0/</code> directory.</p>
<p>The value must be one of those range names exactly; it is not mapped from a plain pg_tle version. Any other value is rejected with an error listing the valid ranges; for a plain pg_tle version (e.g. <code>1.5.0</code>), the error also names the range it falls in.</p>
</div>
</div>
<div class="sect2">
Expand Down Expand Up @@ -2088,7 +2088,7 @@ <h3 id="_asciidoc"><a class="anchor" href="#_asciidoc"></a><a class="link" href=
<div class="sect2">
<h3 id="_pgxntool_pgtle_version"><a class="anchor" href="#_pgxntool_pgtle_version"></a><a class="link" href="#_pgxntool_pgtle_version">8.4. PGXNTOOL_PGTLE_VERSION</a></h3>
<div class="paragraph">
<p>Default: unset (generates every known pg_tle version range). Set on the command line to a range name (<code>1.0.0-1.4.0</code>, <code>1.4.0-1.5.0</code> or <code>1.5.0+</code>, exactly) to limit <code>make pgtle</code> to that one range; any other value is passed through unvalidated and generates a bogus <code>pg_tle/&lt;value&gt;/</code> directory. Not named <code>PGTLE_VERSION</code>: make auto-imports same-named environment variables, and that name collided silently with CI jobs that set a <code>PGTLE_VERSION</code> env var for an unrelated purpose (which pg_tle to test against). See <a href="#_pgtle">pgtle</a>.</p>
<p>Default: unset (generates every known pg_tle version range). Set on the command line to a range name (<code>1.0.0-1.4.0</code>, <code>1.4.0-1.5.0</code> or <code>1.5.0+</code>, exactly) to limit <code>make pgtle</code> to that one range; any other value is rejected with an error. Not named <code>PGTLE_VERSION</code>: make auto-imports same-named environment variables, and that name collided silently with CI jobs that set a <code>PGTLE_VERSION</code> env var for an unrelated purpose (which pg_tle to test against). See <a href="#_pgtle">pgtle</a>.</p>
</div>
</div>
<div class="sect2">
Expand Down Expand Up @@ -2217,7 +2217,7 @@ <h2 id="_copyright"><a class="anchor" href="#_copyright"></a><a class="link" hre
</div>
<div id="footer">
<div id="footer-text">
Last updated 2026-10-07 16:10:44 -0500
Last updated 2026-10-07 16:35:22 -0500
</div>
</div>
</body>
Expand Down
30 changes: 27 additions & 3 deletions pgtle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
# Extension name (required). Must match a .control file basename
# in the current directory.
#
# --pgtle-version VERSION
# Generate for specific pg_tle version only (optional).
# Format: 1.0.0-1.4.0, 1.4.0-1.5.0, or 1.5.0+
# --pgtle-version RANGE
# Generate for one pg_tle version range only (optional).
# Must be exactly one of: 1.0.0-1.4.0, 1.4.0-1.5.0, or 1.5.0+
# A plain pg_tle version (e.g. 1.5.2) is rejected, with a hint naming
# the range it falls in.
# Default: Generate all supported versions
#
# --get-dir VERSION
Expand Down Expand Up @@ -291,6 +293,27 @@ get_version_dir() {
fi
}

# Die unless $1 is exactly one of PGTLE_VERSIONS. If it parses as a plain
# pg_tle version instead, name the range --get-dir puts it in. --get-dir runs
# as a child process because get_version_dir relies on errexit to stop on a
# parse failure, and errexit is suspended inside an if condition.
validate_pgtle_range() {
local range="$1"
local r
for r in "${PGTLE_VERSIONS[@]}"; do
[ "$range" = "$r" ] && return 0
done

local msg="invalid pg_tle version range: '$range'
Valid ranges: ${PGTLE_VERSIONS[*]}"
local dir
if dir=$("${BASH_SOURCE[0]}" --get-dir "$range" 2>/dev/null); then
msg="$msg
'$range' looks like a pg_tle version; did you mean ${dir#pg_tle/}?"
fi
die 1 "$msg"
}

# Get pg_tle version from installed extension
# Returns version string or empty if not installed
get_pgtle_version() {
Expand Down Expand Up @@ -407,6 +430,7 @@ parse_args() {
shift 2
;;
--pgtle-version)
validate_pgtle_range "$2"
PGTLE_VERSION="$2"
shift 2
;;
Expand Down
Loading