Re:Re: Fwd: BUG #17017: Two versions of the same row of records are returned in one query

From: 李可强 <52194501011(at)stu(dot)ecnu(dot)edu(dot)cn>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: tgl <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re:Re: Fwd: BUG #17017: Two versions of the same row of records are returned in one query
Date: 2022-10-06 07:28:28
Message-ID: tencent_1113A409264D6BCD0ADCE312@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Peter,&nbsp;

Thank you for your kind response.&nbsp; If possible, I want to discuss more about my confusion on this problem.&nbsp;

You have mentioned that "a predicate on the PK is not special in Postgres". Does it mean that PG takes PK as a common column instead of the identifier of rows if selecting rows by a predicate on the PK? If it is so, in a relational database, PG may break the unique constraints on PK.&nbsp;&nbsp;

For example, in my mentioned bug case, the query on PG returns two rows which have the same PK. From my point of view, such a behavior violates the primary key unique constraint.&nbsp;

Look forward to the response.

Thank you.

&nbsp;
&nbsp;
------------------&nbsp;Original&nbsp;------------------
From: "Peter&nbsp;Geoghegan";
Date: 2021年5月20日(星期四) 上午9:56
To: "52194501011(at)stu(dot)ecnu(dot)edu(dot)cn"<52194501011(at)stu(dot)ecnu(dot)edu(dot)cn>;
Cc: "tgl"; "pgsql-bugs";
Subject: Re: Fwd: BUG #17017: Two versions of the same row of records are returned in one query

&nbsp;
On Wed, May 19, 2021 at 12:27 AM 李可强 <52194501011(at)stu(dot)ecnu(dot)edu(dot)cn&gt; wrote:
&gt; There is no need to return the old version written by committed transactions. The query result fo Session B is very confusing!

FWIW I think that it's a matter of how the standard is interpreted.
You expect something that Kyle Kingsbury called "Adya repeatable
read". This interpretation of RR allows an application which only
accesses records by primary key to get serializable execution.
Essentially, the primary key is special in a system that uses
traditional two-phase locking (or something closer to it than the
Postgres model). But a predicate on the PK is not special in Postgres.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Frank van Vugt 2022-10-06 15:16:40 v15rc2(/v15rc1/v15b4) shadowbuild fails when using src from symlink
Previous Message Nathan Bossart 2022-10-05 19:00:55 Re: Startup process on a hot standby crashes with an error "invalid memory alloc request size 1073741824" while replaying "Standby/LOCK" records