From f1504a07e8339f02e634b202493cdcb0bae5c63c Mon Sep 17 00:00:00 2001
From: "Stephen R. van den Berg" <srb@cuci.nl>
Date: Tue, 6 Jun 2017 13:39:30 +0200
Subject: [PATCH] pgsql: By default serialise portal use; avoids unexpected
 parallelism.

---
 lib/modules/Sql.pmod/pgsql.pike | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike
index db250c5290..004c5a44ed 100644
--- a/lib/modules/Sql.pmod/pgsql.pike
+++ b/lib/modules/Sql.pmod/pgsql.pike
@@ -1932,7 +1932,8 @@ private inline void throwdelayederror(object parent) {
     if(!sizeof(preparedname) || !tp || !tp.preparedname) {
       if(!sizeof(preparedname))
         preparedname=
-          (portal._unnamedstatementkey = unnamedstatement->trylock(1))
+          (portal._unnamedstatementkey =
+           (syncparse ? unnamedstatement->lock : unnamedstatement->trylock)(1))
            ? "" : PTSTMTPREFIX+int2hex(ptstmtcount++);
       PD("Parse statement %O=%O\n",preparedname,q);
       plugbuffer = c->start();
-- 
GitLab