bug report: some issues about pg_15_stable(8fa4a1ac61189efffb8b851ee77e1bc87360c445)

From: zwj <sxzwj(at)vip(dot)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: bug report: some issues about pg_15_stable(8fa4a1ac61189efffb8b851ee77e1bc87360c445)
Date: 2024-02-18 01:37:39
Message-ID: tencent_1862D94C23E71924A878C3D107FBDFE6C60A@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

&nbsp;&nbsp; I found an issue while using the latest version of PG15 (8fa4a1ac61189efffb8b851ee77e1bc87360c445).

&nbsp;&nbsp; This question is about 'merge into'.

&nbsp;&nbsp; When two merge into statements are executed concurrently, I obtain the following process and results.&nbsp;
&nbsp;&nbsp; Firstly, the execution results of each Oracle are different, and secondly, I tried to understand its execution process and found that it was not very clear.

&nbsp;<merge into &amp; merge into&gt;

The first merge statement clearly updates the year field for ID 2 and 3, and then inserts the row for ID 4.
But when the second merge statement is executed, the year field of id 2 is actually updated based on the execution of the first merge statement, and then insert rows of id 3 and id 4.
I don't understand, I think if it is updated, it should be that both ID 2 and 3 have been updated.
I am currently unable to determine whether ID 4 should be updated or insert.

According to the results from Oracle, the second merge statement should have updated id 2 3 4.

<update &amp; merge into&gt;&nbsp;&nbsp;
I think the problem with the above scenario is due to the concurrent scenarios of update and merge, the behavior of PG and Oracle is consistent. The following figure:

(The results of Oracle and PG are consistent)
&nbsp;

&nbsp;&nbsp; In my opinion, in the concurrent scenarios of mergeand merge, the behavior of pg seems inconsistent. Can you help me analyze and take a look, and help us use SQL with clearer semantics?
&nbsp; Looking forward to your reply.

Thanks
wenjiang_zhang

Attachment Content-Type Size
2DD0CCBF@53328A71.635FD165.jpg image/jpeg 427.4 KB
75CB55EA@A6206805.635FD165.jpg image/jpeg 199.5 KB
F1665EF6@6A4A2B1E.635FD165.jpg image/jpeg 80.9 KB
sql_test_merge&merge.sql application/octet-stream 1.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-02-18 01:48:27 Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
Previous Message jian he 2024-02-18 01:30:44 Re: Add pg_basetype() function to obtain a DOMAIN base type