Query builder regression in 0.2
See original GitHub issueIssue type:
[ ] question [X] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[X] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
TypeORM version:
[X] latest
[ ] @next
[X] 0.1.20
(or put your version here)
Steps to reproduce or a small repository showing the problem:
Query builder generated SQL changed after upgrade to 0.2 in a way that affects results. This
connection
.getRepository(Model)
.createQueryBuilder('model')
.select('id')
.whereInIds([ 1, 2 ])
.andWhere('column = 1')
.getMany());
produces
WHERE ("model"."id" = $1) OR ("model"."id" = $2) AND column = 1 -- PARAMETERS: [1,2]
in 0.2.5, and
WHERE ("model"."id"=$1 OR "model"."id"=$2) AND column = 1 -- PARAMETERS: [1,2]
in 0.1.20. Because of the parentheses over id
conditions have changed, a different set of results is returned. If the order of the conditions is changed to
connection
.getRepository(Model)
.createQueryBuilder('model')
.select('id')
.where('column = 1')
.andWhereInIds([ 1, 2 ])
.getMany());
the generated SQL is
WHERE column = 1 AND (("model"."id" = $1) OR ("model"."id" = $2)) -- PARAMETERS: [1,2]
for 0.2.5 and
WHERE column = 1 AND ("model"."id"=$1 OR "model"."id"=$2) -- PARAMETERS: [1,2]
for 0.1.20, and both thus return the same results.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (8 by maintainers)
Top Results From Across the Web
0.3.7 (2022-06-29) | TypeORM Docs
Use QueryBuilder to build queries containing manual joins. Connection , ConnectionOptions are deprecated, new names to use are: DataSource and DataSourceOptions ...
Read more >Bulk update via raw query in TypeORM - Stack Overflow
How can I do bulk update via raw query in TypeORM? ... How can I change names of few users in one transaction?...
Read more >Machine Learning: Polynomial Regression with Python
test_size=0.2 : we will split our dataset (10 observations) into 2 parts (training set, test set) and the ratio of test set compare...
Read more >Changelog | Objection.js - GitHub Pages
fix regression: QueryBuilder.from is broken. # 0.3.2. # What's new. Improved relation expression whitespace handling. # 0.3.1.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yep, I know how to fix it and will try to do this in few days 😃
okay, so if it does following query:
then we shall make a fix to make it this way: