fix for BUG #3720: wrong results at using ltree

Filip Rembiałkowski <filip.rembialkowski@gmail.com>

From: Filip Rembiałkowski <filip.rembialkowski@gmail.com>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2019-03-05T21:27:02Z
Lists: pgsql-hackers

Attachments

Hi all,

Here is my attempt to fix a 12-years old ltree bug (which is a todo item).

I see it's not backward-compatible, but in my understanding that's
what is documented. Previous behavior was inconsistent with
documentation (where single asterisk should match zero or more
labels).

http://archives.postgresql.org/pgsql-bugs/2007-11/msg00044.php

Commits

  1. Back-patch addition of stack overflow and interrupt checks for lquery.

  2. Fix lquery's NOT handling, and add ability to quantify non-'*' items.

  3. Improve error messages in ltree_in and lquery_in.

  4. Fix lquery's behavior for consecutive '*' items.

  5. Protect against overflow of ltree.numlevel and lquery.numlevel.