Improve documentation on DETACH PARTITION lock levels
authorAlvaro Herrera
Thu, 6 May 2021 20:42:30 +0000 (16:42 -0400)
committerAlvaro Herrera
Thu, 6 May 2021 20:42:30 +0000 (16:42 -0400)
This was forgotten in 71f4c8c6f74b.

Reported-by: Pavel Luzanov
Author: Amit Langote 
Discussion: https://postgr.es/m/0688e7c3-8bc8-a3e4-9d8e-3bcbbf3e1f4d@postgrespro.ru

doc/src/sgml/ddl.sgml
doc/src/sgml/ref/alter_table.sgml

index b4648321dc4c29cdae4edd01e42b26b0954cdfa1..63bc946c3b6254f61fbecee29493a2dd89124375 100644 (file)
@@ -3915,18 +3915,25 @@ DROP TABLE measurement_y2006m02;
    
      Another option that is often preferable is to remove the partition from
      the partitioned table but retain access to it as a table in its own
-     right:
+     right.  This has two forms:
 
 
 ALTER TABLE measurement DETACH PARTITION measurement_y2006m02;
+ALTER TABLE measurement DETACH PARTITION measurement_y2006m02 CONCURRENTLY;
 
 
-     This allows further operations to be performed on the data before
+     These allow further operations to be performed on the data before
      it is dropped. For example, this is often a useful time to back up
      the data using COPYpg_dump, or
      similar tools. It might also be a useful time to aggregate data
      into smaller formats, perform other data manipulations, or run
-     reports.
+     reports.  The first form of the command requires an
+     ACCESS EXCLUSIVE lock on the parent table.
+     Adding the CONCURRENTLY qualifier as in the second
+     form allows the detach operation to require only
+     SHARE UPDATE EXCLUSIVE lock on the parent table, but see
+     ALTER TABLE ... DETACH PARTITION
+     for details on the restrictions.
    
 
    
@@ -4163,17 +4170,6 @@ ALTER INDEX measurement_city_id_logdate_key
         might be poor.)
        
       
-
-      
-       
-        Some operations require a stronger lock when using declarative
-        partitioning than when using table inheritance.  For example,
-        removing a partition from a partitioned table requires taking
-        an ACCESS EXCLUSIVE lock on the parent table,
-        whereas a SHARE UPDATE EXCLUSIVE lock is enough
-        in the case of regular inheritance.
-       
-      
      
     
 
index 9cef1f101eb25f8828a062bd2abe70fc100b7e1a..087f640dc07bbfdbb9d9ca36e0fac22f36af1e09 100644 (file)
@@ -967,7 +967,7 @@ WITH ( MODULUS numeric_literal, REM
     
    
 
-   
+    id="sql-altertable-detach-partition">
     DETACH PARTITION partition_name [ CONCURRENTLY | FINALIZE ]