Skip to content

fix(postgres-bulkcreate): updateOnDuplicate uses correct PK column names - #11433

Closed
PeledYuval wants to merge 1 commit into
sequelize:masterfrom
PeledYuval:master
Closed

PeledYuval wants to merge 1 commit into
sequelize:masterfrom
PeledYuval:master

Conversation

@PeledYuval

Copy link
Copy Markdown
Contributor

Pull Request check-list

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? - no need
  • Did you update the typescript typings accordingly (if applicable)? - not applicable
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

This pull request fixes the following issue:
#11432

When performing bulkCreate with updateOnDuplicate using Postgres dialect, the generated query has bad column names. The query has the Javascript model's field names instead of the column names.

@PeledYuval

Copy link
Copy Markdown
Contributor Author

I'm debating where to add tests for this issue, since it relates to model.js and Postgres dialect:

  • test/unit/model/bulkCreate.test.js? (but this is dialect-agnostic and my fix is PG centric)
  • test/unit/dialects/postgres/model.test.js? (which would be a new file)
  • test/integration/model/bulkCreate.test.js? (dialect-agnostic)
  • test/integration/dialects/postgres/model.test.js? (which would be a new file)

Please advise and I will add appropriate tests.

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 this pull request may close these issues.

1 participant