Bug 6702 - Recursive CTE support (WITH Clause)
Summary: Recursive CTE support (WITH Clause)
Status: NEW
Alias: None
Product: SQL
Classification: Unclassified
Component: all (show other bugs)
Version: -- development
Hardware: All All
: Highest enhancement
Assignee: SQL devs
Depends on:
Reported: 2019-04-26 13:16 CEST by Antoine.Carme@Laposte.net
Modified: 2020-02-15 22:09 CET (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Antoine.Carme@Laposte.net 2019-04-26 13:16:48 CEST
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Build Identifier: 


I am working on a project translating mahien learning models in SQL. This project works well on the most used databases including MonteDB, of course.


This issue here is to mention the absence of recursive CTE support in Monetdb (documented here : https://www.monetdb.org/Documentation/Manuals/SQLreference/SQLSyntaxOverview). I also found no issue in the bug tracker for this.

Recursive CTEs are useful to translate recurrent neural networks into SQL.

Some succesful usage of recursive CTEs is available here :


For a lot of databases, it is OK. Hive/Impala and MonetDB are missing.

I know this is not a very standard usage, but it does the job in a very elegant way (one unique SQL select statement for the whole neural network, tested).

Some code for postgresql :


The same for SQLite :


etc ...

Do you have plans to add this feature ?

Thanks in advance


Reproducible: Always
Comment 1 Antoine.Carme@Laposte.net 2019-04-26 13:20:42 CEST
Pleas read "translating machine learning models in SQL."
Comment 2 Alex Ossipov 2019-05-04 08:51:00 CEST
This is the same requirement as described in the bug 3347.
Comment 3 Antoine.Carme@Laposte.net 2019-05-04 11:47:09 CEST

Thanks a lot for your comment. 

Bug 3347 was originally about a "CREATE FUNCTION" clause.

What I need is a "WITH RECURSIVE" clause that you describe properly in the bug 3347, comment 3.

IMHO, these two features are to be kept separate as they require different fixes (at least at the SQL syntactic level).

Comment 4 Alex Ossipov 2020-02-15 22:09:01 CET
Antoine, I absolutely agree with your point and eager to see this implemented in upcoming releases so I dared raise importance of this feature