BUG #15738: _SPI_connected fail

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: rekgrpth(at)gmail(dot)com
Subject: BUG #15738: _SPI_connected fail
Date: 2019-04-05 06:40:36
Message-ID: 15738-21723084f3009ceb@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15738
Logged by: Geo Sil
Email address: rekgrpth(at)gmail(dot)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

Browse pgsql-bugs by date

  From Date Subject
Next Message Etsuro Fujita 2019-04-05 12:07:47 Re: BUG #15724: Can't create foreign table as partition
Previous Message Amit Langote 2019-04-05 05:07:22 Re: BUG #15733: An insert destined at partition created after a column has been dropped from the parent table fails