Skip to content

[v6] raw query replacements - semicolon terminated fields not being replaced #14517

Closed

Description

@Azerothian

Issue Creation Checklist

Bug Description

SSCCE

Here is the link to the SSCCE for this issue: LINK-HERE

What do you expect to happen?

if the replacement variable is at the end of a SQL statement and it is directly terminated with a semicolon it should still replace the variable. (works in 6.19.0 and below)

  await sequelize.query(`UPDATE "foo" SET "name" = :newName;`, {
    replacements: {
      newName: "Working"
    }
  });
[Sequelize] Executed (default): UPDATE "foo" SET "name" = 'Working'; [Elapsed time: 0 ms] 

What is actually happening?

It ignores the field and attempts to run the query and crashes out

  await sequelize.query(`UPDATE "foo" SET "name" = :newName;`, {
    replacements: {
      newName: "Working"
    }
  });
[Sequelize] Executed (default): UPDATE "foo" SET "name" = :newName; [Elapsed time: 0 ms] 

Environment

  • Sequelize version: 6.19.1
  • Node.js version: v16.13.2
  • Database & Version: postgres 13

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

  • Yes, I have the time and I know how to start.
  • 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.

Activity

  1. Azerothian commented on May 18, 2022

    @Azerothian
    Author

    Seems to be introduced with this pull request #14472

  2. self-assigned this
    on May 18, 2022
  3. ephys commented on May 18, 2022

    @ephys
    Member

    On it :)

  4. ephys commented on May 18, 2022

    @ephys
    Member

    PR: #14518

  5. ephys commented on May 18, 2022

    @ephys
    Member

    Fix released

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions