Re: BUG #17983: Assert IsTransactionState() failed when empty string statement prepared in aborted transaction

From: Japin Li <japinli(at)hotmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17983: Assert IsTransactionState() failed when empty string statement prepared in aborted transaction
Date: 2023-06-21 01:45:23
Message-ID: MEYP282MB16694FA5DA0442708310344DB65DA@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Wed, 21 Jun 2023 at 00:32, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Japin Li <japinli(at)hotmail(dot)com> writes:
>> Yeah, SearchSysCache1() need in an transaction block, here is a patch
>> fixed it.
>
> I'm not sure if anyone out there is expecting that this case should
> work, but it probably did work at one time. Rather than throwing
> an error, it'd be better to fix plancache.c so it doesn't fail.
> I looked at the code and found that that's pretty much a one-line
> fix, because there are already code paths that avoid doing anything
> extra for transaction control commands (e.g ROLLBACK, which'd
> otherwise have this same issue).

Agreed, it's much better than throwing an error. LGTM.

>> Another question, why should we need to create a plan cache entry for
>> empty input?
>
> Well, we have to have something to support the wire protocol behavior
> for this case. No doubt we could hack up postgres.c to handle it
> without a plan cache entry, but it'd be far more invasive to do it
> there.
>

Thanks for your explanation! Got it.

--
Regrads,
Japin Li.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2023-06-21 03:59:06 Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
Previous Message Tomas Vondra 2023-06-20 23:40:56 Re: BUG #17986: Inconsistent results of SELECT affected by btree index