• Igor Babaev's avatar
    MDEV-31657 Crash on query using CTE with the same name as a base table · 54ed3939
    Igor Babaev authored
    If a query contained a CTE whose name coincided with the name of one of
    the base tables used in the specification of the CTE and the query had at
    least two references to this CTE in the specifications of other CTEs then
    processing of the query led to unlimited recursion that ultimately caused
    a crash of the server.
    
    Any secondary non-recursive reference to a CTE requires creation of a copy
    of the CTE specification. All the references to CTEs in this copy must be
    resolved. If the specification contains a reference to a base table whose
    name coincides with the name of then CTE then it should be ensured that
    this reference in no way can be resolved against the name of the CTE.
    54ed3939
cte_nonrecursive.result 73.1 KB