-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RelationIdLoader is not respecting maxAliasLength
#9379
Closed
janzipek opened this issue
Sep 16, 2022
· 3 comments
· Fixed by #9380 · May be fixed by antz-snyk1/gradle-npm-monorepo-example#5
Closed
RelationIdLoader is not respecting maxAliasLength
#9379
janzipek opened this issue
Sep 16, 2022
· 3 comments
· Fixed by #9380 · May be fixed by antz-snyk1/gradle-npm-monorepo-example#5
Labels
Comments
janzipek
pushed a commit
to janzipek/typeorm
that referenced
this issue
Sep 16, 2022
Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database. Closes: typeorm#9379
janzipek
pushed a commit
to janzipek/typeorm
that referenced
this issue
Sep 16, 2022
Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database. Closes: typeorm#9379
7 tasks
janzipek
pushed a commit
to janzipek/typeorm
that referenced
this issue
Sep 16, 2022
Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database. Closes: typeorm#9379
pleerock
pushed a commit
that referenced
this issue
Sep 19, 2022
Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database. Closes: #9379 Co-authored-by: Jan Zípek <jan@zipek.cz>
I'm having |
ok... it's because inverse side reference should be different than the referencedColumnName in my case |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue Description
RelationIdLoader
class is doing selects, but it's not usingDriverUtils.buildAlias
so the selects can end up being truncated and all related behaviour is broken. This for example breaksrelationLoadStrategy: 'query'
when the relation key ends up being too long.Expected Behavior
RelationIdLoader
should useDriverUtils.buildAlias
when creating column aliases generating column aliases that fit themaxAliasLength
prop of driver.Actual Behavior
RelationIdLoader
ignoresmaxAliasLength
.Steps to Reproduce
(in postgresql)
Schema
This is because RelationIdLoader will generate column with name:
SuperLongTableNameWhichIsRelatedToOriginal_relatedToOriginal_superLongTableNameId
which is then truncated by database and all the conditions in the code fail because of that.Relevant issues
#3118
My Environment
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?
(EDIT: Fixed the example, the names were too short)
The text was updated successfully, but these errors were encountered: