[PATCH] Fix LTREE subpath with negative offset

Started by Marcus Gartner6 months ago2 messageshackers
Jump to latest
#1Marcus Gartner
m.a.gartner@gmail.com

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. A duplicate
block of code has been removed which allowed an offset as low as -2n.

Attachments:

0001-Fix-LTREE-subpath-with-negative-offset.patchapplication/octet-stream; name=0001-Fix-LTREE-subpath-with-negative-offset.patchDownload+3-6
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Marcus Gartner (#1)
Re: [PATCH] Fix LTREE subpath with negative offset

Marcus Gartner <m.a.gartner@gmail.com> writes:

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. A duplicate
block of code has been removed which allowed an offset as low as -2n.

Nice catch ... as far as I can see from the git history, that mistake
has been there since day one.

I'm inclined to put this in master only, without a back-patch.
It's not fixing any case that should work, and it seems possible
that somebody out there is depending on the bogus behavior.

regards, tom lane