-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue description
See title
Expected Behavior
I would expect that if the @ManyToMany relation results in no results in SQL, that the relation would be empty as well.
Actual Behavior
But the relation is an array with 1 element in it that has all fields null but the @VirtualColumn field is set to 0 (its a virtual column to sum something).
Steps to reproduce
I've added a test reproduction to typeorm/typeorm in PR #10432
My Environment
| Dependency | Version |
|---|---|
| Operating System | MacOS 13.3.1 |
| Node.js version | 18.12 |
| Typescript version | 4.9.5 |
| TypeORM version | 0.3.14 |
Additional Context
The behavior is the same as in #7450, but the @VirtualColumn adds a field that results in 0, and so its not null. The fix for #7450 does not catch this.
If you remove the @VirtualColumn definition from Category.ts, the fix for #7450 work well again, but that just proves that #7450 has not fixed the root cause of this.
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?
Yes, I have the time, but I don't know how to start. I would need guidance.
tfarras