knex: Cannot seem to use named bindings for arrays
var knex = require('knex');
var postgresConn = 'postgresql://user:pw@host:port/db?tcpKeepAlive=true';
var redshift = knex({
client: 'pg',
connection: postgresConn
});
var sql = redshift.raw('select * from schema.table where col_1 in (:col_1_values) and col_2 = :col_2_value',
{col_1_values: [[1, 2, 3]], col_2_value: 99}).toString();
console.log(sql);
Expected output: select * from schema.table where col_1 in (1,2,3) and col_2 = ‘99’
Actual output: select * from schema.table where col_1 in (:col_1_values) and col_2 = ‘99’
knex version: 0.10.0 pg version: 3.6.2
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 15 (3 by maintainers)
Any news on this? I really could use WHERE IN in my code, but I cannot get arrays to work
Fixed this by adding a space before the (
Could this be added to the documentation, please?