From 178f2dafde01f0a7fcfbcc83265f71fe7a8caf13 Mon Sep 17 00:00:00 2001 From: csrapr <26280794+csrapr@users.noreply.github.com> Date: Thu, 25 Feb 2021 19:03:50 +0000 Subject: [PATCH] Fix: wrong bind on db.taskEx --- lib/db.js | 6 ++---- lib/extendedQueries.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/db.js b/lib/db.js index e5d28cbd..15345e63 100644 --- a/lib/db.js +++ b/lib/db.js @@ -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')) diff --git a/lib/extendedQueries.js b/lib/extendedQueries.js index 65911b09..8982f86f 100644 --- a/lib/extendedQueries.js +++ b/lib/extendedQueries.js @@ -1,6 +1,6 @@ const getSchema = () => 'public' -const getDefaultSchema = () => 'public2' +const getDefaultSchema = () => 'public' const any = (obj, query, variables) => { const schema = getSchema()