Re: SPI isolation changes - Mailing list pgsql-hackers

From Seino Yuki
Subject Re: SPI isolation changes
Date
Msg-id 0cae650bcf9ac49a43ae975d37eb203f@oss.nttdata.com
Whole thread Raw
In response to Re: SPI isolation changes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2023-07-01 01:47, Tom Lane wrote:
> Seino Yuki <seinoyu@oss.nttdata.com> writes:
>> 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"
> 
> Even if you just did SPI_commit?  That *should* fail if you just do
> it right off the bat in a SPI-using procedure, because you're already
> within the transaction that called the procedure.  But I think it
> will work if you do SPI_commit followed by this SPI_execute.
> 
>             regards, tom lane

I'm sorry. I understood wrongly.
SPI_execute(SET TRANSACTION ISOLATION LEVEL ~ ) after executing 
SPI_commit succeeded.

Thank you. My problem is solved.

Regards,
-- 
Seino Yuki
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: MERGE ... RETURNING
Next
From: Dean Rasheed
Date:
Subject: Re: MERGE ... WHEN NOT MATCHED BY SOURCE