Re: SPI Interface to Call Procedure with Transaction Control Statements?

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Jack LIU <toliujiayi(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: SPI Interface to Call Procedure with Transaction Control Statements?
Date: 2019-01-15 10:49:37
Message-ID: 87va2qkxkg.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Jack" == Jack LIU <toliujiayi(at)gmail(dot)com> writes:

Jack> Hi Andrew,
Jack> This is my code to call the procedure with
Jack> SPI_connect_ext(SPI_OPT_NONATOMIC).

Ah. You need to take a look at exec_stmt_call in plpgsql, and do the
same things it does with snapshot management (specifically, setting the
no_snapshot flag on the plan that you're going to execute). SPI forces
atomic mode if the normal snapshot management is in use, because
otherwise a commit inside the procedure would warn about still having a
snapshot open.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-15 11:06:48 Re: SPI Interface to Call Procedure with Transaction Control Statements?
Previous Message Masahiko Sawada 2019-01-15 10:42:08 Re: Log a sample of transactions