Fix attribute mapping for COPY TO on partitioned tables.
Masahiko Sawada <msawada@postgresql.org>
Author:
Masahiko Sawada <msawada@postgresql.org>
Date: 2026-05-14T17:32:34Z
Releases:
19 (unreleased)
Fix attribute mapping for COPY TO on partitioned tables. Commit 4bea91f21f61 enabled COPY TO on a partitioned table to read tuples from its partitions and mapped them to the root table's tuple descriptor before output. However, it incorrectly built the attribute map from the root table to the partition. This commit fixes by building the attribute map from the partition to the root table, ensuring that partition attributes are correctly mapped to their corresponding root attributes. Author: Chao Li <lic@highgo.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/85EA70F3-C3DB-477B-B856-EA569FDAAE7C@gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/copyto.c | modified | +2 −2 |
| src/test/regress/expected/copy.out | modified | +11 −0 |
| src/test/regress/sql/copy.sql | modified | +9 −0 |
Discussion
- Fix bug of COPY TO support partition table 5 messages · 2026-05-14