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
9 changes: 9 additions & 0 deletions HISTORY.asc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
STABLE
------
== Fix `pgtle.sh` rejecting non-numeric version aliases like `stable`
`extract_version_from_filename()` required every version segment to start
with a digit, so extensions using a persistent `stable` pseudo-version
(`default_version = 'stable'`) failed with "Cannot parse version from
filename". Widened to accept any non-empty, `--`-free version string,
matching how pg_tle itself treats extension versions.

2.1.0
-----
== Fix setup.sh / pgxntool-sync.sh / update-setup-files.sh inside a git worktree
Expand Down
12 changes: 10 additions & 2 deletions pgtle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,18 @@ extract_version_from_filename() {
# Match patterns:
# - ext--1.0.0 → FROM_VERSION=1.0.0, TO_VERSION=""
# - ext--1.0.0--2.0.0 → FROM_VERSION=1.0.0, TO_VERSION=2.0.0
# - ext--stable → FROM_VERSION=stable, TO_VERSION="" (pg_tle treats
# versions as opaque strings; see check_valid_version_name() in
# pg_tle's tleextension.c, which only forbids empty strings, "--",
# and leading/trailing "-" — no numeric requirement)
#
# Each version segment is [^-]+(-[^-]+)* : one or more non-dash runs
# joined by single dashes, so a segment can't be empty, start/end with
# "-", or contain "--" (which is reserved as the FROM/TO delimiter).

if [[ "$basename" =~ ^${EXTENSION}--([0-9][0-9.]*)(--([0-9][0-9.]*))?$ ]]; then
if [[ "$basename" =~ ^${EXTENSION}--([^-]+(-[^-]+)*)(--([^-]+(-[^-]+)*))?$ ]]; then
FROM_VERSION="${BASH_REMATCH[1]}"
TO_VERSION="${BASH_REMATCH[3]}" # Empty for non-upgrade files
TO_VERSION="${BASH_REMATCH[4]}" # Empty for non-upgrade files
return 0
else
die 1 "Cannot parse version from filename: $filename
Expand Down
Loading