Skip to content

Conversation

cocoeyes02
Copy link
Contributor

refs: #2384

@cocoeyes02 cocoeyes02 changed the title ['add SQL Parentheses for whereRaw [9.x] Add SQL Parentheses for whereRaw in order to use SoftDelete safely Oct 17, 2020
@cocoeyes02 cocoeyes02 marked this pull request as ready for review October 17, 2020 14:38
@mfn
Copy link
Contributor

mfn commented Oct 17, 2020

So the idea of your problem with operator precedence ("or" vs "and") is to always wrap the where in parenthesis?

Might be a stretch, but maybe people rely on this. You're effectively changing the literal raw query the user provided, which does not sound like a good idea.


I can see your problem though, it's absolutely clear that there an existing where condition applied with interferes with your expectation of operator precedence. But OTOH, it has to be clear that there are additional where conditions, otherwise the trait wouldn't make sense.

Personally, if others agree there's something to fix, it should be done only in this context. But I think the proper "fix" is to maybe improve the docs.

IMHO 😄

@cocoeyes02
Copy link
Contributor Author

IMO, people don't always read document. So if possible, I want enable people to use SoftDelete safely if people don't read document.

But OTOH, I think I don't wanna make destructive change. If it affects another feature, I'll close this PR and I'll improve the docs.

@taylorotwell
Copy link
Member

I dunno if I feel comfortable modifying the raw query.

@cocoeyes02
Copy link
Contributor Author

ok, I'll improve the docs.

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 this pull request may close these issues.

3 participants