Re: Fix bug of COPY TO support partition table

Masahiko Sawada <sawada.mshk@gmail.com>

From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Chao Li <li.evan.chao@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, jian he <jian.universality@gmail.com>
Date: 2026-05-14T16:36:21Z
Lists: pgsql-hackers
On Thu, May 14, 2026 at 9:25 AM Fujii Masao <masao.fujii@gmail.com> wrote:
>
> On Thu, May 14, 2026 at 7:00 PM Chao Li <li.evan.chao@gmail.com> wrote:
> > As shown above, COPY incorrectly outputs all NULLs.
>
> Good catch!

Yeah, it should be fixed. Thank you for the report!

>
> > The fix is straightforward, just reverse the order of `rel` and `root_rel` when calling `build_attrmap_by_name_if_req()`. After the fix, COPY works correctly:
>
> Thanks for the patch! It looks good to me.
>

LGTM too. I'll take care of it as this is my commit, if you're okay
with it, Fujii-san.

Regards,


--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com