Branch: Tag:

2017-06-27

2017-06-27 10:30:15 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Short circuit prepared statement-cache race.

1923:    /*    * FIXME What happens with regards to this detection when presented with    * multistatement text-queries? +  * The primary function of this detection is to ensure a SYNC +  * right after a COMMIT, and no SYNC after a BEGIN.    */    int transtype = .pgsql_util.transendprefix->match(q) ? TRANSEND    : .pgsql_util.transbeginprefix->match(q) ? TRANSBEGIN : NOTRANS;
2016:    ->add(PGFLUSH)   #endif    ; -  } else -  PD("Using prepared statement for %O\n", q); +  } else { // Use the name from the cache +  preparedname = tp.preparedname; // to shortcut a potential race +  PD("Using prepared statement %s for %O\n", preparedname, q); +  }    portal._preparedname=preparedname;    if(!tp || !tp.datatypeoid) {    PD("Describe statement %O\n",preparedname);