Skip to content

Commit e58ca22

Browse files
authored
fix: command complete
1 parent fd6621b commit e58ca22

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/pg/lib/client.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,11 @@ class Client extends EventEmitter {
471471
_handleCommandComplete(msg) {
472472
const query = this._getCurrentQuery()
473473
if (query == null) {
474+
// In pipeline mode, commandComplete might be received after query is processed
475+
// This can happen due to message timing, so we can safely ignore it
476+
if (this._pipelining) {
477+
return
478+
}
474479
const error = new Error('Received unexpected commandComplete message from backend.')
475480
this._handleErrorEvent(error)
476481
return

packages/pg/lib/query.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,7 @@ class Query extends EventEmitter {
280280
rows: this.rows,
281281
})
282282

283-
if (!this.rows) {
284-
connection.pipelineSync()
285-
} else {
286-
connection.flush()
287-
}
283+
connection.flush()
288284
}
289285
}
290286

0 commit comments

Comments
 (0)