Branch: Tag:

2020-06-10

2020-06-10 21:29:56 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Release portals that had background-exceptions during bind.

1970:    procmessage();    }    +  private void stasherror(int|object portal, mixed err) { +  if (stringp(err)) { +  if (!objectp(portal)) +  portal = this; +  if (!portal->delayederror) +  portal->delayederror = err; +  } +  if (objectp(portal)) +  portal->_purgeportal(); +  } +  +  private void tryprepbind(sql_result portal, array dtoid) { +  mixed err = catch(portal->_preparebind(dtoid)); +  if (err) { +  stasherror(portal, err); +  if (!stringp(err)) +  throw(err); +  } +  } +     private void procmessage() {    mixed err;    int terminating = 0;
2299:   #endif    if (portal._tprepared)    portal._tprepared.datatypeoid = a; -  Thread.Thread(portal->_preparebind, a); +  Thread.Thread(tryprepbind, portal, a);    break;    }    case 'T': {
2629:    terminating = 1;    err = 0;    } else if (stringp(err)) { -  sql_result or; -  if (!objectp(or = portal)) -  or = this; -  if (!or.delayederror) -  or.delayederror = err; +    #ifdef PG_DEBUGMORE    showportalstack("THROWN");   #endif -  if (objectp(portal)) -  portal->_releasesession("ERROR"); +  stasherror(portal, err);    portal = 0;    if (!waitforauthready)    continue; // Only continue if authentication did not fail