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
StatusNew

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
Description:        

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",
SPI_result_code_string(rc))));
    (void)SPI_start_transaction();
    PG_TRY(); if ((rc = SPI_execute(src, false, 0) < 0)) ereport(ERROR,
(errmsg("SPI_execute = %s", SPI_result_code_string(rc)))); else {
        (void)SPI_commit();
    } PG_CATCH(); {
        (void)SPI_rollback();
    } PG_END_TRY();
    if ((rc = SPI_finish()) != SPI_OK_FINISH) ereport(ERROR,
(errmsg("SPI_finish = %s", SPI_result_code_string(rc))));
    (void)ProcessCompletedNotifies();
    (void)pgstat_report_activity(STATE_IDLE, src);
    (void)pgstat_report_stat(true);
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

Messages

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