Re: A question about StartSubTransaction

2022-09-13 Thread Japin Li
On Wed, 14 Sep 2022 at 13:52, Tom Lane wrote: > Japin Li writes: >> Why should we set s->state to TRANS_START and then TRANS_INPROGRESS? > > I believe it's so that if an error gets thrown somewhere in that > area, we'll recover properly. I'd be the first to say that this > stuff isn't terribly

Re: A question about StartSubTransaction

2022-09-13 Thread Tom Lane
Japin Li writes: > IIRC, AtSubStart_Memory, AtSubStart_ResourceOwner and > AfterTriggerBeginSubXact don't > use s->state. No, they don't. > Why should we set s->state to TRANS_START and then TRANS_INPROGRESS? I believe it's so that if an error gets thrown somewhere in that area, we'll recover

A question about StartSubTransaction

2022-09-13 Thread Japin Li
Hi hackers, I found the StartSubTransaction has the following code: static void StartSubTransaction(void) { [...] s->state = TRANS_START; /* * Initialize subsystems for new subtransaction * * must initialize resource-management st