When running TRUNCATE CASCADE on a child of a partitioned table referenced by another partitioned table, the truncate was not applied to partitions of the referencing table; this could leave rows violating the constraint in the referencing partitioned table. Repair by walking the pg_constraint chain all the way up to the topmost referencing table.
Note: any partitioned tables containing FKs that reference other partitioned tables should be checked for possible violating rows, if TRUNCATE has occurred in partitions of the referenced table.
9710d3d4a8 Fix TRUNCATE .. CASCADE on partitions
doc/src/sgml/ref/truncate.sgml | 3 ++
src/backend/catalog/heap.c | 84 +++++++++++++++++++++++++++++++++-
src/test/regress/expected/truncate.out | 50 ++++++++++++++++++++
src/test/regress/sql/truncate.sql | 38 +++++++++++++++
4 files changed, 173 insertions(+), 2 deletions(-)