I've searched a lot and this is deprecated question.
I'm trying to bulk insert in a table.
My approach was like this
knex('test_table').where({
user: '[email protected]',
})
.then(result => {
knex.transaction(trx => {
Bluebird.map(result, data => {
return trx('main_table')
.insert(data.insert_row)
}, { concurrency: 3 })
.then(trx.commit);
})
.then(() => {
console.log("done bulk insert")
})
.catch(err => console.error('bulk insert error: ', err))
})
this could work if the columns where text or numeric columns, but i have jsonb columns
But I got this error:
invalid input syntax for type json
How can I solve this problem?