diff --git a/packages/pg-cursor/index.js b/packages/pg-cursor/index.js index 9bbda641a..eaa1c66e4 100644 --- a/packages/pg-cursor/index.js +++ b/packages/pg-cursor/index.js @@ -217,6 +217,13 @@ class Cursor extends EventEmitter { } this._closePortal() + + if (this.connection._ending) { + // No point returning an error, we're finishing up either way. + cb() + return promise + } + this.connection.once('readyForQuery', function () { cb() })