Re: SPI isolation changes - Mailing list pgsql-hackers

From Seino Yuki
Subject Re: SPI isolation changes
Date
Msg-id af887ad064def8745da3f429aae9cd7e@oss.nttdata.com
Whole thread Raw
In response to Re: SPI isolation changes  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: SPI isolation changes
List pgsql-hackers
Thanks for the reply!

On 2023-06-30 23:26, Heikki Linnakangas wrote:
> On 30/06/2023 17:15, Seino Yuki wrote:
>> Hi,
>> 
>> When I read the documents and coding of SPI, [1]
>> I found that the following the SPI_start_transaction does not support
>> transaciton_mode(ISOLATION LEVEL, READ WRITE/READ ONLY) like BEGIN
>> command. [2]
>> Is there a reason for this?
> 
> Per the documentation for SPI_start_transaction that you linked to:
> 
> "SPI_start_transaction does nothing, and exists only for code
> compatibility with earlier PostgreSQL releases."
> 
> I haven't tested it, but perhaps you can do "SET TRANSACTION ISOLATION
> LEVEL" in the new transaction after calling SPI_commit() though. Or
> "SET DEFAULT TRANSACTION ISOLATION LEVEL" before committing.

I understand that too.
However, I thought SPI_start_transaction was the function equivalent to 
BEGIN (or START TRANSACTION).
Therefore, I did not understand why the same option could not be 
specified.

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?

Regards,
-- 
Seino Yuki
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: SPI isolation changes
Next
From: Tom Lane
Date:
Subject: Re: Assert !bms_overlap(joinrel->relids, required_outer)