> > Maybe we want to add "free_parsestate(pstate);" after the "EndCopyFrom()" as well?
>
> What actual issue could occur if free_parsestate() is not called there?
>
> Since pstate->p_target_relation does not seem to be used afterward,
> omitting free_parsestate() appears mostly harmless to me. Bascailly
> calling free_parsestate() after make_parsestate() seems intuitive,
> but from a quick grep I found several places that call make_parsestate()
> without a corresponding free_parsestate().
Yeah, I agree that it's harmless. I just noticed the comment above make_parsestate():
Caller should eventually release the ParseState via free_parsestate().
Not sure whether it's worth to fix all of these places.
--
Regards,
ChangAo Chen