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

whereIn doesn't work with more than one value in 'values' on pg #101

Open
mkozjak opened this issue Jul 19, 2014 · 1 comment
Open

whereIn doesn't work with more than one value in 'values' on pg #101

mkozjak opened this issue Jul 19, 2014 · 1 comment

Comments

@mkozjak
Copy link
Contributor

mkozjak commented Jul 19, 2014

(haven't tested other drivers)

Throws:
{"name":"error","length":84,"severity":"ERROR","code":"42601","position":"423","file":"scan.l","line":"1053","routine":"scanner_yyerror"}

when this piece of code is used:

myModel.using(connection)
.whereIn('nameofcolumn', ['one', 'two'])
.all....

Managed to debug up to _runSql3, where it gave:

text: select t0."nameofcolumn1" AS c0, t0."nameofcolumn2" AS c1 FROM tablename1 AS t0 WHERE t0.nameofcolumn IN ($1,?)

values: [ 'one', 'two' ]

@buchatsky
Copy link

It's easy - the author forgot to add "g" to Regexp . Driver.js:
getSqlFromSqlTree: function(sqlTree) {
...
// process where
...
expr = expr.replace(/?/g, getValuesSubstitutionStringFunc);

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

No branches or pull requests

2 participants