Closed AndriyGd closed 6 years ago
Objection and knex escape all inputs to prevent SQL injection attacks. You need to use raw
:
const { raw } = require('objection');
let task = await Plst.query()
.select('ECO1', 'STZW', 'STPA', 'KLAR', 'PNUM', 'a.ATTE', 'FZ_TFZU_1')
.leftOuterJoin('ATST as a', raw('cast(PLST.FZ_TFZU_1 as int)'), 'a.ATNU')
.where('PLST.PNUM', '=', req)
.andWhere('PLST.GPR1', '>', 0)
.andWhere('PLST.WALO', '=', 0);
Thanks a lot. It has helped for me.
I tried to use join with different type columns as "text" and 'integer' For converting text to integer I using native method PostgreSQL named 'cast'.
My query.
But I'm got exception.
...the sql
How may be resolved this issue.