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 doesn't clone all values correctly #4156

Closed
pippinthegreat opened this issue May 18, 2019 · 0 comments · Fixed by #4157
Closed

QueryExpressionMap doesn't clone all values correctly #4156

pippinthegreat opened this issue May 18, 2019 · 0 comments · Fixed by #4157

Comments

@pippinthegreat
Copy link

Issue type:

[x] bug report

Database system/driver:

[x] postgres

TypeORM version:

[x] 0.2.17 (or put your version here)

Steps to reproduce or a small repository showing the problem:

QueryExpressionMap's clone method doesn't clone all values correctly, specifically insertColumns, whereEntities, and nativeParameters are currently cloned by reference. The persistent reference to nativeParameters between clones causes issues with postgres as it generates the wrong parameter names ($1, $2, $3...) in QueryBuilder.computeWhereParameter()

...
const qb = connection.manager
  .createQueryBuilder("Post", "post");

await Promise.all([
  qb.clone().where({ id: 1 }).getOne(),
  qb.clone().where({ id: 1 }).getOne(),
]);

// postgres error - "could not determine data type of parameter $1"

I'm opening this issue so I can reference it in a PR that fixes this bug

pleerock added a commit that referenced this issue May 30, 2019
fixes #4156 - QueryExpressionMap not cloning all values correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant