From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | mahendrakar s <mahendrakarforpg(at)gmail(dot)com> |
Cc: | pgsql-novice <pgsql-novice(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Run a transaction block through SPI_execute |
Date: | 2023-11-23 15:47:45 |
Message-ID: | 2658681.1700754465@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
mahendrakar s <mahendrakarforpg(at)gmail(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ibrahim Shaame | 2023-11-25 07:39:28 | reporting tree into separate columns |
Previous Message | mahendrakar s | 2023-11-23 13:03:32 | Run a transaction block through SPI_execute |