Re: BUG #16801: Invalid memory access on WITH RECURSIVE with nested WITHs
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Lakhin <exclusion@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2021-02-26T01:17:50Z
Lists: pgsql-bugs
Attachments
- bug-16801-fix-v2.patch (text/x-diff) patch v2
On Thu, Feb 25, 2021 at 10:19:43AM -0500, Tom Lane wrote: > For me, the example I gave fails in a non-debug build. With the code as > of HEAD, I get "ERROR: stack depth limit exceeded" or a segfault. With > your patch applied, it complains about w6 not having the correct form for > a recursive CTE. Yes, same here for the test stressing makeDependencyGraphWalker(). The second test I posted for checkWellFormedRecursionWalker() passes on HEAD in a non-debug build, and triggers an assertion with debug builds. So the second test requires CLOBBER_FREED_MEMORY but not DEBUG_LIST_MEMORY_USAGE. That's not as good as the first one, but I would vote for having this second test than none to stress more the list handling when looking after invalid self-references in a CTE. This gives me the attached. I would rather have both tests in the version committed, but if you think that this addition is not necessary I won't fight hard either :) -- Michael
Commits
-
Fix list-manipulation bug in WITH RECURSIVE processing.
- 80ca8464fe02 14.0 landed
- 49076fd3ba6b 13.3 landed