Skip to content

0.3.14 breaks addOrderBy #9960

@paoesco

Description

@paoesco

Issue description

0.3.14 introduced a change where the alias is not mapped correctly to SQL equivalent

Expected Behavior

The following code:

query = query.addOrderBy("verification.createdAt", "DESC", "NULLS LAST");

should produce the following SQL:

ORDER BY "verification"."created_at" DESC NULLS LAST LIMIT 10

Actual Behavior

The following code:

query = query.addOrderBy("verification.createdAt", "DESC", "NULLS LAST");

is translated to SQL:

ORDER BY "verification_created_at" [object Object] LIMIT 10

Steps to reproduce

Create a query with createQueryBuilder and add addOrderBy.

My Environment

Dependency Version
Operating System Mac OS
Node.js version 18.15.0
Typescript version 4.8.4
TypeORM version 0.3.14

Additional Context

I believe the issue has been introduced by the following PR: https://github.com/typeorm/typeorm/pull/9914/files

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions