Skip to content

fix: Update RelationIdLoader to use DriverUtils.getAlias - #9380

Merged
pleerock merged 1 commit into
typeorm:masterfrom
janzipek:fix/9379
Sep 19, 2022
Merged

pleerock merged 1 commit into
typeorm:masterfrom
janzipek:fix/9379

Conversation

@janzipek

Copy link
Copy Markdown
Contributor

Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database.

Closes: #9379

Description of change

Updates RelationIdLoader class to use DriverUtils.getAlias to generate column aliases. This resolves issues with databases that have hard limit on column aliases such as Postgres.

I've never contributed to this project so I'm definitely not sure if this fix is correct, but it did resolve the issue with relationLoadStrategy: query I was having. There may be other places that don't use this util? Maybe this breaks some other behaviour that expects the columns to be properly named?

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@janzipek janzipek changed the title fix: RelationIdLoader is now using column alias utils fix: Update RelationIdLoader to use DriverUtils.getAlias Sep 16, 2022
Update RelationIdLoader to use DriverUtils.getAlias to prevent aliases being possibly trimmed by database.

Closes: typeorm#9379
@pleerock
pleerock merged commit a917d65 into typeorm:master Sep 19, 2022
@pleerock

Copy link
Copy Markdown
Member

Thank you for contribution! 🎉

@pleerock

Copy link
Copy Markdown
Member

damn you forgot to remove .only...

@janzipek

janzipek commented Sep 19, 2022 •

Copy link
Copy Markdown
Contributor Author

Sorry :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

RelationIdLoader is not respecting maxAliasLength

3 participants