Content-Length: 261332 | pFad | http://github.com/postgrespro/postgres_cluster/commit/cfbecf8100ecb83c07c2017f843b0642580416bf

2B Enforce child constraints during COPY TO a partitioned table. · postgrespro/postgres_cluster@cfbecf8 · GitHub
Skip to content

Commit cfbecf8

Browse files
committed
Enforce child constraints during COPY TO a partitioned table.
The previous coding inadvertently checked the constraints for the partitioned table rather than the target partition, which could lead to data in a partition that fails to satisfy some constraint on that partition. This problem seems to date back to when table partitioning was introduced; prior to that, there was only one target table for a COPY, so the problem didn't occur, and the code just didn't get updated. Etsuro Fujita, reviewed by Amit Langote and Ashutosh Bapat Discussion: https://postgr.es/message-id/5ABA4074.1090500%40lab.ntt.co.jp
1 parent 870d896 commit cfbecf8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/commands/copy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2709,7 +2709,8 @@ CopyFrom(CopyState cstate)
27092709
check_partition_constr = false;
27102710

27112711
/* Check the constraints of the tuple */
2712-
if (cstate->rel->rd_att->constr || check_partition_constr)
2712+
if (resultRelInfo->ri_RelationDesc->rd_att->constr ||
2713+
check_partition_constr)
27132714
ExecConstraints(resultRelInfo, slot, estate, true);
27142715

27152716
if (useHeapMultiInsert)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/cfbecf8100ecb83c07c2017f843b0642580416bf

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy