Skip to content

Loading…

DDC-2113: SQLFilter incorrect results when WHERE clause contains OR expression #2799

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user vclayton:

When using an SQLFilter, if applied to a query that contains only OR expressions in the WHERE clause, the generated SQL is incorrect.

Example:

  • SQLFilter returns a constraint like "{$tableAlias}.accountid={$accountId}"
  • Query: "SELECT u FROM User u WHERE u.fname='bob' OR u.lname='bob'"

Resulting SQL:
"SELECT u FROM User u WHERE u.fname='bob' OR u.lname='bob' AND u.accountid=2"

Expected:
"SELECT u FROM User u WHERE (u.fname='bob' OR u.lname='bob') AND u.accountid=2"

The problem is that the order of operations is wrong. I'm getting users who aren't in account 2, making SQLFilter unreliable.

@doctrinebot

Comment created by @FabioBatSilva:

Fixed : 129d6ef

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3.1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.