diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-02-07 17:09:36 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-02-07 17:09:36 -0300 |
commit | 9710d3d4a87f428a10f63015a0d75ccf028dd137 (patch) | |
tree | aee0aa98a33841a09d55f28cad6ea52667b4d0dc /doc/src | |
parent | cb5b28613d553b1c750622e91cbc96c83f052a63 (diff) | |
download | postgresql-9710d3d4a87f428a10f63015a0d75ccf028dd137.tar.gz postgresql-9710d3d4a87f428a10f63015a0d75ccf028dd137.zip |
Fix TRUNCATE .. CASCADE on partitions
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.
Reported-by: Christophe Courtois
Author: Jehan-Guillaume de Rorthais
Discussion: https://postgr.es/m/20200204183906.115f693e@firost
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/truncate.sgml | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/truncate.sgml b/doc/src/sgml/ref/truncate.sgml index c1e42376abd..5922ee579e1 100644 --- a/doc/src/sgml/ref/truncate.sgml +++ b/doc/src/sgml/ref/truncate.sgml @@ -124,6 +124,9 @@ TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="parameter">name</replaceable> [ option can be used to automatically include all dependent tables — but be very careful when using this option, or else you might lose data you did not intend to! + Note in particular that when the table to be truncated is a partition, + siblings partitions are left untouched, but cascading occurs to all + referencing tables and all their partitions with no distinction. </para> <para> |