On Thu, 20 Jan 2022 at 00:38, Tom Lane <t...@sss.pgh.pa.us> wrote: > Bharath Rupireddy <bharath.rupireddyforpostg...@gmail.com> writes: >> +1. It looks like a thinko from c532d15d. There's no code in between, >> so switching to oldcontext doesn't make sense. > > Agreed. > >> I think we also need to remove MemoryContextSwitchTo(oldcontext); at >> the end of BeginCopyTo in copyto.c, because we are not changing memory >> contexts in between. > > Hmm, I think it'd be a better idea to remove the one in the middle of > BeginCopyTo. The code after that is still doing setup of the cstate, > so the early switch back looks to me like trouble waiting to happen. >
Agreed I see you have already push this patch on master (89f059bdf52), why not remove MemoryContextSwitchTo in the middle of BeginCopyTo in this commit? -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd.