From: | ZhangChi <798604270(at)qq(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David G(dot) Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #19036: Failed prepared INSERT statement make another SELECT query generate wrong result |
Date: | 2025-08-30 02:09:36 |
Message-ID: | tencent_54A1234BA5BBD0D799F312645426A071D308@qq.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi,
I got it, thank you for your detailed explanation!
Original
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Date: 2025年8月30日 10:06
To: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: ZhangChi <798604270(at)qq(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19036: Failed prepared INSERT statement make another SELECT query generate wrong result
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Friday, August 29, 2025, ZhangChi <798604270(at)qq(dot)com> wrote:
>> I still have a problem with this. When an INSERT fails, why not undo all
>> the effects of the INSERT?
> Performance.
Yeah. You can certainly argue that it was a design error to make
nextval() nontransactional, but the performance advantages are
compelling. Most critically, if we required that, then any
transaction doing nextval() would block all other transactions from
doing nextval() on the same sequence: they'd have to wait to see if
the first one committed before they could know what value to use.
(Deadlocks between nextval's on different sequences could be a problem
as well.) So the odds that we'd change that are nil, even if there
weren't a few decades worth of backwards compatibility to worry about.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2025-08-30 12:00:02 | BUG #19037: Planner fails on estimating array length with "no relation entry" error |
Previous Message | Tom Lane | 2025-08-30 02:06:32 | Re: BUG #19036: Failed prepared INSERT statement make another SELECT query generate wrong result |