Cannot find alias for relation at user
See original GitHub issueIssue Description
Cannot find alias for relation at user
at _loop_3 (src/query-builder/QueryBuilder.ts:944:27)
at UpdateQueryBuilder.Object.<anonymous>.QueryBuilder.findColumnsForPropertyPath (node_modules/typeorm/query-builder/QueryBuilder.js:817:27)
at UpdateQueryBuilder.<anonymous> (src/query-builder/QueryBuilder.ts:1059:68)
at step (node_modules/typeorm/node_modules/tslib/tslib.js:143:27)
at Object.next (node_modules/typeorm/node_modules/tslib/tslib.js:124:57)
at UpdateQueryBuilder.Object.<anonymous>.QueryBuilder.getWhereCondition (src/query-builder/QueryBuilder.ts:1195:80)
at UpdateQueryBuilder.Object.<anonymous>.UpdateQueryBuilder.where (src/query-builder/UpdateQueryBuilder.ts:176:32)
at EntityManager.Object.<anonymous>.EntityManager.update (src/entity-manager/EntityManager.ts:514
PR with test case: https://github.com/typeorm/typeorm/pull/8024
Expected Behavior
await getRepository(WorkspaceMemberEntity).update(
{
user: {
id: createdWorkspace.createdById!,
},
workspace: {
id: createdWorkspace.id,
},
},
{
role: WorkspaceMemberRole.MEMBER,
}
);
It should update the table.
Actual Behavior
Error: Cannot find alias for relation at user.
My Environment
Dependency | Version |
---|---|
Operating System | Windows |
Node.js version | 14.16 |
Typescript version | 4.3.5 |
TypeORM version | ^0.2.36 |
Relevant Database Driver(s)
DB Type | Reproducible |
---|---|
aurora-data-api |
no |
aurora-data-api-pg |
no |
better-sqlite3 |
no |
cockroachdb |
no |
cordova |
no |
expo |
no |
mongodb |
no |
mysql |
no |
nativescript |
no |
oracle |
no |
postgres |
yes |
react-native |
no |
sap |
no |
sqlite |
no |
sqlite-abstract |
no |
sqljs |
no |
sqlserver |
no |
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Cannot find alias for relation at ... · Issue #8310 - GitHub
UPDATE: I was having the 'cannot find alias' error on the save method. The reason was that the ID I was providing in...
Read more >typeorm "\"user\" alias was not found. Maybe you forgot to join ...
Try to add a condition to your join: .leftJoinAndSelect('user.avatar', 'avatar', 'avatar.id = user.avatarId'). or/and inverse side to the ...
Read more >TypeORM: How to Use Column Alias when Querying Data
This succinct tutorial shows you how to use column aliases to assign temporary names to columns when selecting data with TypeORM.
Read more >Query with distinct sort and column alias produces error ...
I'm trying to use sql query on azure-databricks with distinct sort and aliases. SELECT DISTINCT album.ArtistId AS my_alias; FROM album ORDER ...
Read more >CREATE ALIAS statement - Progress Documentation
Also, if there are several connected databases, the application can ask the user which one to select, then set the alias accordingly. The...
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
Is there a repository I can clone to easily set this up?
Edit: I have found the instructions at https://github.com/typeorm/typeorm/blob/master/DEVELOPER.md
Hi,
I will be able to continue my investigation / tweak the test case to hopefully reproduce the issue starting next Tuesday.