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
relationLoadStrategy query: ER_NONUNIQ_TABLE during recursive call
Expected Behavior
When using a ManyToOne from an Entity to the same Entity, TypeORM should use an alias when joining the table
Actual Behavior
The table "Folder" is called twice with the same alias :
SELECT Folder.id AS Folder_id, Folder.familyLinkId AS Folder_familyLinkId, Folder.id AS Folder_id, Folder.familyLinkId AS Folder_familyLinkId
FROM folderFolder
INNER JOIN folderFolder ON Folder.familyLinkId = Folder.id
WHERE Folder.id IN (7486)
IMHO (I'm really not a javascript dev 😅), I think the problem is in FindOptionsUtils.ts, in applyRelationsRecursively.
In case of relationLoadStrategy query, it use "relation" but not "relationAlias"
Thank you all for the good work, keep up with it !
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.
The text was updated successfully, but these errors were encountered:
I would like to get this fix into the new version of Typeorm as soon as possible because we have a table with these relationships that cause a problem when using relationLoadStrategy: 'query'
My current error that we need to bypass in every query manually right now
During the creation of join typeorm creates relations with the same alias as the table we are trying to get data from
Error: table name "Collection" specified more than once
Issue description
relationLoadStrategy query: ER_NONUNIQ_TABLE during recursive call
Expected Behavior
When using a ManyToOne from an Entity to the same Entity, TypeORM should use an alias when joining the table
Actual Behavior
The table "Folder" is called twice with the same alias :
SELECT
Folder
.id
ASFolder_id
,Folder
.familyLinkId
ASFolder_familyLinkId
,Folder
.id
ASFolder_id
,Folder
.familyLinkId
ASFolder_familyLinkId
FROM
folder
Folder
INNER JOIN
folder
Folder
ONFolder
.familyLinkId
=Folder
.id
WHERE
Folder
.id
IN (7486)Steps to reproduce
@entity()
export class Folder {
}
folders = await folderRepository.find({
relationLoadStrategy: "query",
where: { id: In(foldersID) },
relations: {
family_link: true
}
})
My Environment
Additional Context
IMHO (I'm really not a javascript dev 😅), I think the problem is in FindOptionsUtils.ts, in applyRelationsRecursively.
In case of relationLoadStrategy query, it use "relation" but not "relationAlias"
Thank you all for the good work, keep up with it !
Relevant Database Driver(s)
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.
The text was updated successfully, but these errors were encountered: