From: | Seino Yuki <seinoyu(at)oss(dot)nttdata(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: SPI isolation changes |
Date: | 2023-06-30 16:21:35 |
Message-ID: | aada2d0c68fc3eefa7c5a9889aba7df3@oss.nttdata.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2023-07-01 00:06, Tom Lane wrote:
> Seino Yuki <seinoyu(at)oss(dot)nttdata(dot)com> writes:
>> I also thought that using SPI_start_transaction would be more readable
>> than using SPI_commit/SPI_rollback to implicitly start a transaction.
>> What do you think?
>
> I think you're trying to get us to undo commit 2e517818f, which
> is not going to happen. See the threads that led up to that:
>
> Discussion:
> https://postgr.es/m/3375ffd8-d71c-2565-e348-a597d6e739e3@enterprisedb.com
> Discussion: https://postgr.es/m/17416-ed8fe5d7213d6c25@postgresql.org
>
> It looks to me like you can just change the transaction property
> settings immediately after SPI_start_transaction if you want to.
> Compare this bit in SnapBuildExportSnapshot:
>
> StartTransactionCommand();
>
> /* There doesn't seem to a nice API to set these */
> XactIsoLevel = XACT_REPEATABLE_READ;
> XactReadOnly = true;
>
> Also look at the implementation of SPI_commit_and_chain,
> particularly RestoreTransactionCharacteristics.
>
> regards, tom lane
Thanks for sharing past threads.
I was understand how SPI_start_transaction went no-operation.
I also understand how to set the transaction property.
However, it was a little disappointing that the transaction property
could not be changed only by SPI commands.
Of course, executing SET TRANSACTION ISOLATION LEVEL with SPI_execute
will result in error.
---
SPI_execute("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE", false, 0);
(Log Output)
ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any query
CONTEXT: SQL statement "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"
---
Thanks for answering.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-06-30 16:47:10 | Re: SPI isolation changes |
Previous Message | Ranier Vilela | 2023-06-30 16:20:10 | Re: Avoid unused value (src/fe_utils/print.c) |