MDEV-26095 Infinite recursion when processing embedded recursive CTE
with missing RECURSIVE If a table reference r used inthe specification of a CTE whose definition is contained in the WITH clause where RECURSIVE is omitted then this table reference cannot be considered as a recursive table reference even if it is used in the query that specifies CTE whose name is r. It can be considered only as a reference to an embedding CTE or to a temporary table or to a base table/view. If there is no such object with name r then an error message must be reported. This patch fixes the code that actually in some cases resolved r as a reference to the CTE whose specification contained r if its name was r in spite of the fact that r was not considered as a recursive CTE. This happened in the cases when the definition of r was used in the specification of another CTE. Such wrong name resolution for r led to an infinite recursive invocations of the parser that ultimately crashed the server. This bug is a result of the fix for mdev-13780 that was not quite correct. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Showing
Please register or sign in to comment