public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: mahendrakar s <[email protected]>
Cc: pgsql-novice <[email protected]>
Subject: Re: Run a transaction block through SPI_execute
Date: Thu, 23 Nov 2023 10:47:45 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CABkiuWqsfevi1-GzuNNeqjTMBHMN_HMUmHZOOQZBqLWcY9aU+g@mail.gmail.com>
References: <CABkiuWqsfevi1-GzuNNeqjTMBHMN_HMUmHZOOQZBqLWcY9aU+g@mail.gmail.com>

mahendrakar s <[email protected]> writes:
> When I try to run a transaction block (similar) to below through SPI_execute:
> BEGIN; set transaction read write; ....; COMMIT
> I get an error: SPI_ERROR_TRANSACTION.
> I see that SPI interface does not support transaction manipulation commands.

Yup; you can't execute begin/commit that way.

> Transaction management support only SPI_commit/SPI_rollback.
> I'm more interested in setting `set transaction read write;` through
> SPI interface.

You could look at how plpgsql handles it.  I think though that as
long as you do BEGIN and COMMIT in the approved way, you can feed
the SET through SPI_execute or one of its siblings.

			regards, tom lane






view thread (2+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Run a transaction block through SPI_execute
  In-Reply-To: <[email protected]>

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

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