Skip to content
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

QueryExpressionMap's clone method is missing copying "comment" field #7203

Closed
19 tasks
astritsh opened this issue Dec 17, 2020 · 0 comments · Fixed by #7205, mattwelke/typeorm-postgres-example#165 or newerton/gobarber-2-backend#17

Comments

@astritsh
Copy link
Contributor

astritsh commented Dec 17, 2020

Issue Description

Expected Behavior

Clone method of QueryExpressionMap should copy everything(all its fields).

Actual Behavior

When clone method is being used from methods like getManyAndCount, count query is missing comment field which wasn't cloned from QueryExpressionMap.
Seems that "comment" field is the last field added in QueryExpressionMap but this field was missed to be added on clone method.

// include the output in code tags like these!
  1.  query: /* a comment */ SELECT "simple"."id" AS "simple_id" FROM "sample" "simple" 

  2.  query: SELECT COUNT(1) AS "cnt" FROM "sample" "simple"                        (missing /* a comment */)

Steps to Reproduce

  1. Create a query builder
  2. Add a comment there
  3. call getManyAndCount

Result:
First main query contains the comment, second query for getting the count does not contain the comment.

this.repository
      .createQueryBuilder()
      .comment("a comment")
      .getManyAndCount();

My Environment

Dependency Version
Operating System
Node.js version vX.Y.ZZZ
Typescript version vX.Y.ZZZ
TypeORM version v0.2.29

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • [x ] postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time, and I know how to start.
  • [ x] Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment