-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue type: Bug report
Database system/driver: All SQL databases
TypeORM version: All
WHERE conditions generated by the query builder should all be isolated with parenthesis to avoid bugs due to operators priorities.
Example:
const entries = await repository.createQueryBuilder()
.where('field1 = :value OR field2 = :value', { value: 'foo' })
.andWhere('field3 = :value', { value: 'bar' })
.getMany();Result conditions:
WHERE field1 = 'foo' OR field2 = 'foo' AND field3 = 'bar'
Expected conditions:
WHERE (field1 = 'foo' OR field2 = 'foo') AND (field3 = 'bar')
RDeluxe, OliverLeighC, bdsGrela, dellert, jkillian and 5 moremuamichali, bravadoops and maciej-nowicki-cg24