You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm dynamically creating some filters and it seems that some queries are wrong when the $or operator contains an array with a single element like in the scenario below.
select"e0".*from"schema"."article"as"e0"left join"schema"."user"as"e1"on"e0"."user_id"="e1"."id"where"e1"."id"=1or
("e0"."id"<6)
order by"e0"."id"desclimit3
To Reproduce
Steps to reproduce the behavior:
Instantiate a query builder.
Use the input from above.
Expected behavior
Even though the query is over-complicated (due to being dynamically generated) it should be correctly parsed and transformed into the following SQL instead (using an and instead of an or):
select"e0".*from"schema"."article"as"e0"left join"schema"."user"as"e1"on"e0"."user_id"="e1"."id"where"e1"."id"=1and
("e0"."id"<6)
order by"e0"."id"desclimit3
Additional context
For example, in a more complex scenario where the $or has an array with more than 1 element everything seems to be ok:
Given:
charmpitz
changed the title
Given a single filter on a $or operation the resulted query is wrong.
Given a single filter on a $or operation the resulted query will be wrong.
Aug 30, 2020
charmpitz
changed the title
Given a single filter on a $or operation the resulted query will be wrong.
Given a single filter on an $or operation the resulted query will be wrong.
Aug 30, 2020
charmpitz
changed the title
Given a single filter on an $or operation the resulted query will be wrong.
Given a single filter on an $or operation the resulted sql will be wrong.
Aug 30, 2020
Describe the bug
I'm dynamically creating some filters and it seems that some queries are wrong when the
$or
operator contains an array with a single element like in the scenario below.Stack trace
Given the following arguments:
We receive the following SQL:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Even though the query is over-complicated (due to being dynamically generated) it should be correctly parsed and transformed into the following SQL instead (using an
and
instead of anor
):Additional context
For example, in a more complex scenario where the
$or
has an array with more than 1 element everything seems to be ok:Given:
It is correctly transformed into:
Versions
The text was updated successfully, but these errors were encountered: