Open Gabriel-LUCAS17 opened 1 year ago
I have the exact same behavior, also involving is null
being used twice in the same query
Any news on this? I also encountere the same behavior.
I'm running into similar issues on an entity with @DeleteDateColumn
.
This query sometimes returns null
and sometimes returns the inserted record.
const result = await dataSource.manager.findOne(SomeEntity, {
where: { id: item.id },
});
console.log("result:", result);
// result : null
The flakiness seems to be related to a IS NULL
where clause because when I add withDeleted: true
(which removes the AND ( "SomeEntity"."deletedAt" IS NULL )
), the query always return the inserted record.
const result = await dataSource.manager.findOne(SomeEntity, {
where: { id: item.id },
withDeleted: true,
});
console.log("result:", result);
// result: SomeEntity {
// id: 'f480813f-213f-4ace-b0b6-0e8e1e069bcd',
// ...
// deletedAt: null
// }
I can run both queries one after the other and results will be different.
Describe the bug
I'm trying to make some tests on typeorm with jest and I use pg-mem to simulate my postgres database. But one of the queries I'm using return an empty array with pg-mem while it should return some elements.
The query :
With pg-mem :
With postgres (expected result) :
I suspect it to be related to the behavior of AND / OR operators because :
this works :
this works :
and this works as well :
but this doesn't work :
neither this :
To Reproduce
Reader.ts :
Marking.ts
connection.ts
Test File
pg-mem version
typeorm version