Conditional Expression without right-hand side expression #11806
Unanswered
ozahorulia
asked this question in
Support Questions
Replies: 1 comment
-
Bump |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to use
JSON_CONTAINS
function in a query. I can write my own implementation or use scienta/doctrine-json-functions - doesn't matter, because there's always one big problem. Doctrine's parser enforces me to write condition asWHERE JSON_CONTAINS(...) = true
instead of justWHERE JSON_CONTAINS(...)
.The problem is the index: MySQL's condition
JSON_CONTAINS(...) = 1
does not utilize index whereasJSON_CONTAINS(...)
does use index. In case of a JSON column in a table with million rows, difference between those two queries is drastic: several seconds instead of a couple of ms.Is there a way to make a custom function that can be used in the WHERE clause without the right-hand expression?
Same problem has been raised in this discussion but there's no answer: #9506 (comment)
Beta Was this translation helpful? Give feedback.
All reactions