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
{{ message }}
Repository navigation
getManyAndCount() returns incorrect count value for out-of-bounds skip #11640
getManyAndCount() returns incorrect count value for out-of-bounds skip
Expected Behavior
The following test case illustrates the regression introduced by #11524 :
// test/other-issues/lazy-count/lazy-count.tsit("should execute count query when skip is out-of-bounds",()=>Promise.all(connections.map(asyncfunction(connection){awaitsavePostEntities(connection,5)constafterQuery=connection.subscribers[0]asAfterQuerySubscriberafterQuery.clear()const[entities,count]=awaitconnection.manager.createQueryBuilder(Post,"post").take(10).skip(10)// Skip beyond the total number of records.orderBy("post.id").getManyAndCount()expect(count).to.be.equal(5)expect(entities.length).to.be.equal(0)// The count query MUST be executed when skip is out-of-boundsexpect(afterQuery.getCalledQueries().filter((query)=>query.match(/(count|cnt)/i)),).not.to.be.empty}),))
Actual Behavior
The count query should be executed when skip is out-of-bounds so that the correct count value is returned.
Steps to reproduce
See unit test case
My Environment
Dependency
Version
Operating System
OSX Sequoia 15.5
Node.js version
20.19.1
TypeORM version
0.3.26
Additional Context
No response
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Activity