| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix contrib/ltree's subpath() with negative offset. |
| Date: | 2025-11-01 17:26:05 |
| Message-ID: | E1vFFMb-004ZFw-2b@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix contrib/ltree's subpath() with negative offset.
subpath(ltree,offset,len) now correctly errors when given an offset
less than -n, where n is the number of labels in the given ltree.
There was a duplicate block of code that allowed an offset as low
as -2n. The documentation says no such thing, so this must have
been a copy-and-paste error in the original ltree patch.
While here, avoid redundant calculation of "end" and write
LTREE_MAX_LEVELS rather than its hard-coded value.
Author: Marcus Gartner <m(dot)a(dot)gartner(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAAUGV_SvBO9gWYbaejb9nhe-mS9FkNP4QADNTdM3wdRhvLobwA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ff8aba65d463b144db7c081181b5ccf6eaaf1af4
Modified Files
--------------
contrib/ltree/expected/ltree.out | 2 ++
contrib/ltree/ltree_op.c | 14 +++-----------
contrib/ltree/sql/ltree.sql | 1 +
3 files changed, 6 insertions(+), 11 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2025-11-01 18:02:06 | pgsql: Remove unused variable in recovery/t/006_logical_decoding.pl. |
| Previous Message | Álvaro Herrera | 2025-10-31 17:50:48 | pgsql: pg_createsubscriber: reword dry-run log messages |