public inbox for [email protected]
help / color / mirror / Atom feedRun a transaction block through SPI_execute
2+ messages / 2 participants
[nested] [flat]
* Run a transaction block through SPI_execute
@ 2023-11-23 13:03 mahendrakar s <[email protected]>
2023-11-23 15:47 ` Re: Run a transaction block through SPI_execute Tom Lane <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: mahendrakar s @ 2023-11-23 13:03 UTC (permalink / raw)
To: pgsql-novice <[email protected]>
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.
Documentation: https://www.postgresql.org/docs/current/spi-spi-execute.html
Can you please suggest me how to achieve run the above transaction
block using SPI_ interface?
Transaction management support only SPI_commit/SPI_rollback.
I'm more interested in setting `set transaction read write;` through
SPI interface.
Thanks,
Mahendrakar.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Run a transaction block through SPI_execute
2023-11-23 13:03 Run a transaction block through SPI_execute mahendrakar s <[email protected]>
@ 2023-11-23 15:47 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2023-11-23 15:47 UTC (permalink / raw)
To: mahendrakar s <[email protected]>; +Cc: pgsql-novice <[email protected]>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-11-23 15:47 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 13:03 Run a transaction block through SPI_execute mahendrakar s <[email protected]>
2023-11-23 15:47 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox