Re: Remove redundant MemoryContextSwith in BeginCopyFrom

2022-01-19 Thread Japin Li
On Thu, 20 Jan 2022 at 08:50, Tom Lane wrote: > Japin Li writes: >> I see you have already push this patch on master (89f059bdf52), why not >> remove MemoryContextSwitchTo in the middle of BeginCopyTo in this commit? > > That was a different suggestion from a different person, so I didn't > wan

Re: Remove redundant MemoryContextSwith in BeginCopyFrom

2022-01-19 Thread Tom Lane
Japin Li writes: > I see you have already push this patch on master (89f059bdf52), why not > remove MemoryContextSwitchTo in the middle of BeginCopyTo in this commit? That was a different suggestion from a different person, so I didn't want to muddle the credit. Also, it requires a bit of testin

Re: Remove redundant MemoryContextSwith in BeginCopyFrom

2022-01-19 Thread Japin Li
On Thu, 20 Jan 2022 at 00:38, Tom Lane wrote: > Bharath Rupireddy 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 o

Re: Remove redundant MemoryContextSwith in BeginCopyFrom

2022-01-19 Thread Tom Lane
Bharath Rupireddy 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 memo

Re: Remove redundant MemoryContextSwith in BeginCopyFrom

2022-01-19 Thread Bharath Rupireddy
On Wed, Jan 19, 2022 at 7:51 PM Japin Li wrote: > > > Hi, hackers > > When I read the code of COPY ... FROM ..., I find there is a redundant > MemoryContextSwith() in BeginCopyFrom(). In BeginCopyFrom, it creates > a COPY memory context and then switches to it, in the middle of this > function, i

Re: Remove redundant MemoryContextSwith in BeginCopyFrom

2022-01-19 Thread Fabrízio de Royes Mello
On Wed, Jan 19, 2022 at 11:21 AM Japin Li wrote: > > > Hi, hackers > > When I read the code of COPY ... FROM ..., I find there is a redundant > MemoryContextSwith() in BeginCopyFrom(). In BeginCopyFrom, it creates > a COPY memory context and then switches to it, in the middle of this > function,