Re: fix for BUG #3720: wrong results at using ltree
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Filip Rembiałkowski <filip.rembialkowski@gmail.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>,
Teodor Sigaev <teodor@sigaev.ru>,
Oleg Bartunov <obartunov@postgrespro.ru>
Date: 2019-04-06T15:46:02Z
Lists: pgsql-hackers
=?UTF-8?Q?Filip_Rembia=C5=82kowski?= <filip.rembialkowski@gmail.com> writes: > 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 I took a quick look through this. I see where you're going with this, and I agree that this coding seems like a better match to what it says in the documentation: ... you can put ! (NOT) at the start to match any label that doesn't match any of the alternatives. However, it seems like Teodor and Oleg went to an awful lot of trouble to implement some other behavior. It looks like what's there is trying to do something like "true if this pattern does not match any label between the matches for whatever's around it", rather than just "true if this pattern does not match at one specific position". The number of changes in the expected output for existing regression test cases is also disheartening: it's fairly hard to believe that whoever wrote the test cases didn't think those expected outputs were correct. In short, I'm wondering if we should treat this as a documentation bug not a code bug. But to do that, we'd need a more accurate description of what the code is supposed to do, because the statement quoted above is certainly not a match to the actual behavior. BTW, if we do proceed in this direction, I wonder whether the ltree_gist code needs any adjustments. Thoughts? regards, tom lane
Commits
-
Back-patch addition of stack overflow and interrupt checks for lquery.
- fade4d4dffca 11.8 landed
- e48ff22d39db 9.6.18 landed
- cffa57f52cc4 9.5.22 landed
- 94c9152dc880 12.3 landed
- 8b902e438608 10.13 landed
-
Fix lquery's NOT handling, and add ability to quantify non-'*' items.
- 70dc4c509b33 13.0 landed
-
Improve error messages in ltree_in and lquery_in.
- e07e2a40bd0c 13.0 landed
-
Fix lquery's behavior for consecutive '*' items.
- 9950c8aadf0e 13.0 landed
-
Protect against overflow of ltree.numlevel and lquery.numlevel.
- 8e1e630d004e 9.5.22 landed
- 95f7ddfdad99 13.0 landed
- 5feb3d0b3f6b 11.8 landed
- 39491aa0da48 9.6.18 landed
- 2bb6bdbe5da7 12.3 landed
- 2618ac6c6535 10.13 landed