From b8365d1cb6728c966b283e5ddd014a0d98000aed Mon Sep 17 00:00:00 2001
From: Rasmus Porsager <rasmus@porsager.com>
Date: Thu, 21 Mar 2024 09:47:17 +0100
Subject: [PATCH] Try Sync if not cursor

---
 cjs/src/connection.js  | 2 +-
 deno/src/connection.js | 2 +-
 src/connection.js      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cjs/src/connection.js b/cjs/src/connection.js
index 10184ca3..15fad8ee 100644
--- a/cjs/src/connection.js
+++ b/cjs/src/connection.js
@@ -956,7 +956,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
   function Execute(portal = '', rows = 0) {
     return Buffer.concat([
       b().E().str(portal + b.N).i32(rows).end(),
-      Flush
+      rows === 0 ? Sync : Flush
     ])
   }
 
diff --git a/deno/src/connection.js b/deno/src/connection.js
index 81f26c08..6af94604 100644
--- a/deno/src/connection.js
+++ b/deno/src/connection.js
@@ -959,7 +959,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
   function Execute(portal = '', rows = 0) {
     return Buffer.concat([
       b().E().str(portal + b.N).i32(rows).end(),
-      Flush
+      rows === 0 ? Sync : Flush
     ])
   }
 
diff --git a/src/connection.js b/src/connection.js
index 578a6a02..1f4d9604 100644
--- a/src/connection.js
+++ b/src/connection.js
@@ -956,7 +956,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
   function Execute(portal = '', rows = 0) {
     return Buffer.concat([
       b().E().str(portal + b.N).i32(rows).end(),
-      Flush
+      rows === 0 ? Sync : Flush
     ])
   }