You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the query contains a fixed string that ends with a backslash all placeholders after the string aren't replaced anymore.
Reproducible Example
it("properly replaced placeholders",async()=>{constresult=awaitsequelize.query<{backslash: string;replaced: string}>("select '\\' as backslash, :test as replaced",{replacements: {test: "replaced"},type: QueryTypes.SELECT,});expect(result).toEqual([{baskslash: "\\",replaced: "replaced"}]);});
What do you expect to happen?
All placeholders get successfully replaced and the test above succeeds.
What is actually happening?
Placeholders after the string which ends with a backslash aren't replaced resulting into a syntax error syntax error at or near ":". The query that gets executed is this:
select'\' as backslash, :test as replaced
Environment
Sequelize version: 6.21.0
Node.js version: 16.14.2
If TypeScript related: TypeScript version: 4.7.4
Database & Version: PostgreSQL 11.5
Connector library & Version: pg 8.7.3
Would you be willing to resolve this issue by submitting a Pull Request?
No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered:
Using PostgreSQL dialect replacements don't work if query contains a string with a backslash at the end.
Issue Creation Checklist
Bug Description
When the query contains a fixed string that ends with a backslash all placeholders after the string aren't replaced anymore.
Reproducible Example
What do you expect to happen?
All placeholders get successfully replaced and the test above succeeds.
What is actually happening?
Placeholders after the string which ends with a backslash aren't replaced resulting into a syntax error
syntax error at or near ":"
. The query that gets executed is this:Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: