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

Fix string escape with postgresql on raw SQL queries #586

Merged
merged 2 commits into from May 3, 2013

Conversation

2 participants
@zoulls
Contributor

zoulls commented May 3, 2013

In raw SQL queries (sequelize.query) the string escape is \ but for postgre it's ' (http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS).

example:

var sql = 'UPDATE "test" SET "value"= ? WHERE id = 1';
sequelize.query(sql, {}, null, "isn't a good string escape" );

give into sql:

UPDATE "test" SET "value"= 'isn\'t a good string escape' WHERE id = 1

this request emit an error on postgre.

the request should be:

UPDATE "test" SET "value"= 'isn''t a good string escape' WHERE id = 1

@durango durango merged commit 773b2b6 into sequelize:master May 3, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment