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

Deep conditions nesting on sqlite => stack overflow #805

Open
NikolaiKircher opened this issue Nov 17, 2022 · 0 comments · May be fixed by #806
Open

Deep conditions nesting on sqlite => stack overflow #805

NikolaiKircher opened this issue Nov 17, 2022 · 0 comments · May be fixed by #806

Comments

@NikolaiKircher
Copy link

I am resubmitting this issue from the archived cancan project: Deep conditions nesting on sqlite => stack overflow

Steps to reproduce

https://gist.github.com/NikolaiKircher/5f31bf2b0f9bf969597ce5e6e3f6551f

=> ActiveRecord::StatementInvalid: SQLite3::SQLException: parser stack overflow

Actual behaviour

CanCan constructs sql like so

... where cond0 OR (
  cond1 OR (
    cond2 ...
  )
)

this useless deep nesting on sqlite3 results in a Parser Stack Overflow error.

Expected behaviour

A better SQL would be:

... where cond0 OR cond1 OR cond2 ...

System configuration

Rails version:
6.1.7
Ruby version:
3.0.4
CanCanCan version
3.4.0

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