Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple CTEs should be allowed in recursive WithQuery #830

Open
andrewbaxter opened this issue Oct 26, 2024 · 0 comments · May be fixed by #835
Open

Multiple CTEs should be allowed in recursive WithQuery #830

andrewbaxter opened this issue Oct 26, 2024 · 0 comments · May be fixed by #835

Comments

@andrewbaxter
Copy link

Description

Per https://github.com/SeaQL/sea-query/blob/master/src/backend/query_builder.rs#L780 when you do a recursive with you are only allowed to have one CTE.

In sqlite at least (and I'd expect other dbs as well) you can have any number of CTEs in the with query, per https://sqlite.org/lang_with.html . Especially see example 3.5 which has 4 recursive CTEs and one non-recursive CTE (a).

I'm not sure what the impetus for that line was, but would dropping it be reasonable? Are there other parts of the code that rely on it having only one CTE?

andrewbaxter pushed a commit to andrewbaxter/fork-sea-query that referenced this issue Nov 8, 2024
I tested this with sqlite and the queries execute successfully. It's
possible that there are other incorrect behaviors that can be
pre-emptively caught, perhaps those could be added in a new PR later.
@andrewbaxter andrewbaxter linked a pull request Nov 8, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant