Re: SPI isolation changes

From: Seino Yuki <seinoyu(at)oss(dot)nttdata(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: SPI isolation changes
Date: 2023-06-30 14:56:48
Message-ID: af887ad064def8745da3f429aae9cd7e@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-06-30 15:00:09 Re: Assert !bms_overlap(joinrel->relids, required_outer)
Previous Message Heikki Linnakangas 2023-06-30 14:26:57 Re: SPI isolation changes