Correct comment and some documentation about REPLICA_IDENTITY_INDEX
authorMichael Paquier
Wed, 22 Dec 2021 07:38:42 +0000 (16:38 +0900)
committerMichael Paquier
Wed, 22 Dec 2021 07:38:42 +0000 (16:38 +0900)
catalog/pg_class.h was stating that REPLICA_IDENTITY_INDEX with a
dropped index is equivalent to REPLICA_IDENTITY_DEFAULT.  The code tells
a different story, as it is equivalent to REPLICA_IDENTITY_NOTHING.

The behavior exists since the introduction of replica identities, and
fe7fd4e even added tests for this case but I somewhat forgot to fix this
comment.

While on it, this commit reorganizes the documentation about replica
identities on the ALTER TABLE page, and a note is added about the case
of dropped indexes with REPLICA_IDENTITY_INDEX.

Author: Michael Paquier, Wei Wang
Reviewed-by: Euler Taveira
Discussion: https://postgr.es/m/OS3PR01MB6275464AD0A681A0793F56879E759@OS3PR01MB6275.jpnprd01.prod.outlook.com
Backpatch-through: 10

doc/src/sgml/ref/alter_table.sgml
src/include/catalog/pg_class.h

index beae516f3d116a9ea07ea1241bbd7a69897b56ce..ca959391ef27ac3f3bd429bd4688db40648cdf9d 100644 (file)
@@ -820,16 +820,51 @@ WITH ( MODULUS numeric_literal, REM
      
       This form changes the information which is written to the write-ahead log
       to identify rows which are updated or deleted.  This option has no effect
-      except when logical replication is in use.  DEFAULT
-      (the default for non-system tables) records the
-      old values of the columns of the primary key, if any.  USING INDEX
-      records the old values of the columns covered by the named index, which
-      must be unique, not partial, not deferrable, and include only columns marked
-      NOT NULL.  FULL records the old values of all columns
-      in the row.  NOTHING records no information about the old row.
-      (This is the default for system tables.)
+      except when logical replication is in use.
       In all cases, no old values are logged unless at least one of the columns
       that would be logged differs between the old and new versions of the row.
+     
+      
+       DEFAULT
+       
+        
+         Records the old values of the columns of the primary key, if any.
+         This is the default for non-system tables. 
+        
+       
+      
+
+      
+       USING INDEX index_name
+       
+        
+         Records the old values of the columns covered by the named index,
+         that must be unique, not partial, not deferrable, and include only
+         columns marked NOT NULL. If this index is
+         dropped, the behavior is the same as NOTHING.
+        
+       
+      
+
+      
+       FULL
+       
+        
+         Records the old values of all columns in the row.
+        
+       
+      
+
+      
+       NOTHING
+       
+        
+         Records no information about the old row. This is the default for
+         system tables.
+        
+       
+      
+     
      
     
    
index 78b33b2a7f9b8ae9b0e7b304b86ae738e04f3d5f..e675520f089b92895291baa87d7481bc17b00c20 100644 (file)
@@ -178,7 +178,7 @@ typedef FormData_pg_class *Form_pg_class;
 /*
  * an explicitly chosen candidate key's columns are used as replica identity.
  * Note this will still be set if the index has been dropped; in that case it
- * has the same meaning as 'd'.
+ * has the same meaning as 'n'.
  */
 #define          REPLICA_IDENTITY_INDEX    'i'