Fix for casting boolean values in MySQL#538
Merged
Merged
Conversation
Member
|
I have a suspicion this will create discrepancies between psql/mysql but not 100% sure. Do you know what |
Contributor
Author
select if("true", TRUE, FALSE); -- false
select if("false", TRUE, FALSE);-- false
select if(False, TRUE, FALSE);-- false
select if(TruE, TRUE, FALSE);-- true
select if(TRUE, TRUE, FALSE);-- true
select if(true, TRUE, FALSE);-- true
select if(0, TRUE, FALSE);-- false
select if(1, TRUE, FALSE);-- trueAs far as I understand, there is not really a boolean type in MySQL, much like in C. So anything is false unless it's |
Member
|
Ah I get it now. Thank you. LGTM! |
greg-rychlewski
approved these changes
Jul 19, 2023
Member
|
💚 💙 💜 💛 ❤️ |
josevalim
pushed a commit
that referenced
this pull request
Aug 21, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not sure if this fix is sufficient enough. I've tried it locally and it solves my problem.
One thing I'm not sure is covered is, what if you pass a value that's not true or false to the cast expression? I assume that's just invalid SQL?