Comments - Recursive Common Table Expressions Overview

4 years, 7 months ago Jan Steinman

It took a long time to find out that aggregate functions cannot be used in the recursive portion of a CTE.

I'm trying to do roll-ups of a hierarchical accounting system, without limiting the number of levels that can be traversed. I thought I had it figured out, but kept getting "Query Failed. Restrictions imposed on recursive definitions are violated for table 'CTE2'. Error code 4008."

Is there a list of the "restrictions" that are "imposed" on recursive CTEs?

It seems to me that recursively getting a SUM of account balances that have the same super-account would be a relatively common thing to do!

 
4 years, 6 months ago John Doe

Try setting `standard_compliant_cte` to OFF.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.