pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: rekgrpth@gmail.com
Subject: BUG #15738: _SPI_connected fail
Date: Fri, 05 Apr 2019 06:40:36 +0000
Message-ID: <15738-21723084f3009ceb@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15738
Logged by:          Geo Sil
Email address:      rekgrpth@gmail.com
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



Message-ID: <15738-21723084f3009ceb@postgresql.org>
Permalink:  ../15738-21723084f3009ceb@postgresql.org/
Also on:    postgresql.org/message-id/15738-21723084f3009ceb@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, rekgrpth@gmail.com
  Subject: Re: BUG #15738: _SPI_connected fail
  In-Reply-To: <15738-21723084f3009ceb@postgresql.org>
  References: <15738-21723084f3009ceb@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox