diff --git a/src/js/internal/sql/postgres.ts b/src/js/internal/sql/postgres.ts index 73f17dbb0e..e660430ae8 100644 --- a/src/js/internal/sql/postgres.ts +++ b/src/js/internal/sql/postgres.ts @@ -26,49 +26,46 @@ function wrapPostgresError(error: Error | PostgresErrorOptions) { initPostgres( function onResolvePostgresQuery(query, result, commandTag, count, queries, is_last) { - /// simple queries - if (query[_flags] & SQLQueryFlags.simple) { - // simple can have multiple results or a single result - if (is_last) { - if (queries) { - const queriesIndex = queries.indexOf(query); - if (queriesIndex !== -1) { - queries.splice(queriesIndex, 1); - } - } - try { - query.resolve(query[_results]); - } catch {} - return; - } - $assert(result instanceof SQLResultArray, "Invalid result array"); - // prepare for next query - query[_handle].setPendingValue(new SQLResultArray()); - - if (typeof commandTag === "string") { - if (commandTag.length > 0) { - result.command = commandTag; - } - } else { - result.command = cmds[commandTag]; - } - - result.count = count || 0; - const last_result = query[_results]; - - if (!last_result) { - query[_results] = result; - } else { - if (last_result instanceof SQLResultArray) { - // multiple results - query[_results] = [last_result, result]; - } else { - // 3 or more results - last_result.push(result); + if (is_last) { + if (queries) { + const queriesIndex = queries.indexOf(query); + if (queriesIndex !== -1) { + queries.splice(queriesIndex, 1); } } + try { + query.resolve(query[_results]); + } catch {} return; } + $assert(result instanceof SQLResultArray, "Invalid result array"); + // prepare for next query + query[_handle].setPendingValue(new SQLResultArray()); + + if (typeof commandTag === "string") { + if (commandTag.length > 0) { + result.command = commandTag; + } + } else { + result.command = cmds[commandTag]; + } + + result.count = count || 0; + const last_result = query[_results]; + + if (!last_result) { + query[_results] = result; + } else { + if (last_result instanceof SQLResultArray) { + // multiple results + query[_results] = [last_result, result]; + } else { + // 3 or more results + last_result.push(result); + } + } + return; + /// prepared statements $assert(result instanceof SQLResultArray, "Invalid result array"); if (typeof commandTag === "string") { diff --git a/src/sql/postgres/PostgresSQLConnection.zig b/src/sql/postgres/PostgresSQLConnection.zig index 0ddbd7c13e..f5bbeebdc0 100644 --- a/src/sql/postgres/PostgresSQLConnection.zig +++ b/src/sql/postgres/PostgresSQLConnection.zig @@ -1453,12 +1453,7 @@ pub fn on(this: *PostgresSQLConnection, comptime MessageType: @Type(.enum_litera debug("-> {s}", .{cmd.command_tag.slice()}); defer this.updateRef(); - if (request.flags.simple) { - // simple queries can have multiple commands - request.onResult(cmd.command_tag.slice(), this.globalObject, this.js_value, false); - } else { - request.onResult(cmd.command_tag.slice(), this.globalObject, this.js_value, true); - } + request.onResult(cmd.command_tag.slice(), this.globalObject, this.js_value, false); }, .BindComplete => { try reader.eatMessage(protocol.BindComplete);