Fix: wrong bind on db.taskEx

This commit is contained in:
csrapr 2021-02-25 19:03:50 +00:00 committed by Josh Harvey
parent 440b8e7f61
commit 178f2dafde
2 changed files with 3 additions and 5 deletions

View file

@ -12,13 +12,11 @@ const pgp = Pgp({
obj.taskEx = function () {
const args = pgp.utils.taskArgs(arguments)
const { schema } = args.options
if ('schema' in args.options) {
delete args.options.schema
}
delete args.options.schema
if (schema) {
return obj.task.call(this, args.options, t => {
return t.none('SET search_path to $1:name', [schema])
.then(args.cb.bind(this, t))
.then(args.cb.bind(t, t))
})
}
return Promise.reject(new Error('No schema selected, cannot complete query'))