diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike index 07f11eefab8b54dd3c9bf73e814db60dc1511bb6..3a1da1cce3cab8e79882dcde7c2a8a036d30079d 100644 --- a/lib/modules/Sql.pmod/pgsql.pike +++ b/lib/modules/Sql.pmod/pgsql.pike @@ -1901,7 +1901,7 @@ private inline void throwdelayederror(object parent) { tp=UNDEFINED; .pgsql_util.sql_result portal; portal=.pgsql_util.sql_result(this,c,q, - portalbuffersize,_alltyped,from,forcetext,timeout); + portalbuffersize, _alltyped, from, forcetext, timeout, syncparse); portal._tprepared=tp; #ifdef PG_STATS portalsopened++; @@ -1922,11 +1922,8 @@ private inline void throwdelayederror(object parent) { if(!sizeof(preparedname) || !tp || !tp.preparedname) { if(!sizeof(preparedname)) preparedname= - (portal._unnamedstatementkey= - (syncparse?unnamedstatement->lock:unnamedstatement->trylock)(1)) + (portal._unnamedstatementkey = unnamedstatement->trylock(1)) ? "" : PTSTMTPREFIX+int2hex(ptstmtcount++); - else if(syncparse) - portal._unnamedstatementkey=unnamedstatement->lock(1); PD("Parse statement %O=%O\n",preparedname,q); plugbuffer=c->start()->add_int8('P') ->add_hstring(({preparedname,0,q,"\0\0\0"}),4,4) diff --git a/lib/modules/Sql.pmod/pgsql_util.pmod b/lib/modules/Sql.pmod/pgsql_util.pmod index b00c7212f90f779559dc07f813bc3dfa3e8f4b30..2bda90929220adc90e216078f1e2e3b21fe15342 100644 --- a/lib/modules/Sql.pmod/pgsql_util.pmod +++ b/lib/modules/Sql.pmod/pgsql_util.pmod @@ -488,6 +488,7 @@ class sql_result { final int _fetchlimit; private int alltext; final int _forcetext; + private int syncparse; final string _portalname; @@ -532,7 +533,7 @@ class sql_result { protected void create(object _pgsqlsess,conxion _c,string query, int _portalbuffersize,int alltyped,array params,int forcetext, - int _timeout) { + int _timeout, int _syncparse) { pgsqlsess = _pgsqlsess; cr = (c = _c)->i; _query = query; @@ -546,6 +547,7 @@ class sql_result { _forcetext = forcetext; _state = PORTALINIT; timeout = _timeout; + syncparse = _syncparse; gottimeout = _pgsqlsess->cancelquery; c->closecallbacks+=(<destroy>); } @@ -874,7 +876,7 @@ class sql_result { plugbuffer->add_int16(sizeof(datarowtypes)); if(sizeof(datarowtypes)) plugbuffer->add_ints(map(datarowtypes,oidformat),2); - else if(!paralleliseprefix->match(_query)) { + else if (syncparse || !paralleliseprefix->match(_query)) { lock=pgsqlsess->_shortmux->lock(); if(pgsqlsess->_portalsinflight) { pgsqlsess->_waittocommit++;