pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: FK violation in partitioned table after truncating a referenced partition
Date: Thu, 6 Feb 2020 19:05:25 -0300
Message-ID: <20200206220525.GA31831@alvherre.pgsql> (raw)
In-Reply-To: <20200206220005.GA31399@alvherre.pgsql>

On 2020-Feb-06, Alvaro Herrera wrote:

> Also, I think we should patch the documentation like this, because this
> effect is not 100% obvious.  (For example, if the partition strategy is
> identical in both referenced and referencing tables, you would wish that
> only the equivalent partition is truncated.  However, I doubt this can
> be really implemented.)

And of course, I forgot to attach the file.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

  [text/x-diff] truncate-docs.patch (739B, ../20200206220525.GA31831@alvherre.pgsql/2-truncate-docs.patch)
  download | inline diff:
diff --git a/doc/src/sgml/ref/truncate.sgml b/doc/src/sgml/ref/truncate.sgml
index c1e42376ab..0895fd17eb 100644
--- a/doc/src/sgml/ref/truncate.sgml
+++ b/doc/src/sgml/ref/truncate.sgml
@@ -123,7 +123,9 @@ TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="parameter">name</replaceable> [
    scans, and the whole point is not to do one.  The <literal>CASCADE</literal>
    option can be used to automatically include all dependent tables &mdash;
    but be very careful when using this option, or else you might lose data you
-   did not intend to!
+   did not intend to!  Note in particular that when the table to be truncated
+   is a partition, cascading occurs as if the parent partitioned table is
+   truncated.
   </para>
 
   <para>

view thread (15+ messages)  latest in thread

Message-ID: <20200206220525.GA31831@alvherre.pgsql>
Permalink:  ../20200206220525.GA31831@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200206220525.GA31831@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, jgdr@dalibo.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: FK violation in partitioned table after truncating a referenced partition
  In-Reply-To: <20200206220525.GA31831@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox