PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15738
PG Version11.2
OSalpine 3.9
Opened2019-04-05 06:40:36+00
Reported byGeo Sil

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15738
Logged by:          Geo Sil
Email address:      (redacted)
PostgreSQL version: 11.2
Operating system:   alpine 3.9

this code
    int rc;
    char *src = "do $$begin select 1/0;end$$";
    (void)pgstat_report_activity(STATE_RUNNING, src);
    if ((rc = SPI_connect_ext(SPI_OPT_NONATOMIC)) != SPI_OK_CONNECT)
ereport(ERROR, (errmsg("SPI_connect_ext = %s",
    PG_TRY(); if ((rc = SPI_execute(src, false, 0) < 0)) ereport(ERROR,
(errmsg("SPI_execute = %s", SPI_result_code_string(rc)))); else {
    } PG_CATCH(); {
    } PG_END_TRY();
    if ((rc = SPI_finish()) != SPI_OK_FINISH) ereport(ERROR,
(errmsg("SPI_finish = %s", SPI_result_code_string(rc))));
    (void)pgstat_report_activity(STATE_IDLE, src);
emit exception "invalid transaction termination" because plpgsql increase
_SPI_connected and does not decrease it on exception
with char *src = "select 1/0"; all OK


2019-04-05 06:40:36+00PG Bug reporting formBUG #15738: _SPI_connected fail