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

use flat concatenation instead of nesting conditions #806

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NikolaiKircher
Copy link

@NikolaiKircher NikolaiKircher commented Nov 17, 2022

closes #805

@coorasse
Copy link
Member

coorasse commented May 28, 2024

Thanks for you PR. Could this lead to different results if the conditions are now "joined" without parenthesis?

@NikolaiKircher
Copy link
Author

Thanks for you PR. Could this lead to different results if the conditions are now "joined" without parenthesis?

I think this change should be okay, but I can not guarantee it. (I just copied the solution from the archived cancan project: ryanb/cancan#414 )

I just started the test suite and there are some failing examples, which would need to be adjusted.

DB='sqlite' bundle exec appraisal activerecord_7.0.0 rake

537 examples, 12 failures, 3 pending

  expected: "not (\"articles\".\"secret\" = 1) AND ((\"articles\".\"published\" = 1) OR (\"articles\".\"id\" = 1))"
             got: "(not (\"articles\".\"secret\" = 1) AND (\"articles\".\"published\" = 1) OR \"articles\".\"id\" = 1)"

etc

I also found out, that the problem seems to be resolved with the latest version of sqlite3 (2.0.2)
So maybe we don't even need this fix in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deep conditions nesting on sqlite => stack overflow
3 participants