> On 4 Sep 2020, at 2:21 pm, Peter Geoghegan <pg@bowt.ie> wrote:
>
> On Thu, Sep 3, 2020 at 5:20 PM Hannah Huang <hannah.huang.y@gmail.com> wrote:
>> I’m confused about what will trigger the serializable error. My test environment is PG v12.
>>
>> This is how you can produce the test table:
>
> Serializable isolation level promises to emulate serial transaction
> execution for all committed transactions. I believe that your example
> does not show behavior that breaks that specific promise.
>
> --
> Peter Geoghegan
Hi Peter,
Thank you very much for replying my question.
My confusion is actually:
Transaction B updated the n value of id 2, while transaction A needs to update n value for id 1 referencing the n
valueof id 2.
If the transaction is executed in a serialized way, then the n value of id 2 will be changed in transaction B first,
andthe change will be reflected in the value of id 1in transaction A. However, the two transactions are not executed
concurrently- transaction A executed successfully without seeing changes made in transaction B. Is that a break of
serializableisolation level?
Thanks,
Hannah