Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit28e1e5c

Browse files
committed
Correct comment and some documentation about REPLICA_IDENTITY_INDEX
catalog/pg_class.h was stating that REPLICA_IDENTITY_INDEX with adropped index is equivalent to REPLICA_IDENTITY_DEFAULT. The code tellsa different story, as it is equivalent to REPLICA_IDENTITY_NOTHING.The behavior exists since the introduction of replica identities, andfe7fd4e even added tests for this case but I somewhat forgot to fix thiscomment.While on it, this commit reorganizes the documentation about replicaidentities on the ALTER TABLE page, and a note is added about the caseof dropped indexes with REPLICA_IDENTITY_INDEX.Author: Michael Paquier, Wei WangReviewed-by: Euler TaveiraDiscussion:https://postgr.es/m/OS3PR01MB6275464AD0A681A0793F56879E759@OS3PR01MB6275.jpnprd01.prod.outlook.comBackpatch-through: 10
1 parentda0d8a4 commit28e1e5c

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -820,16 +820,51 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
820820
<para>
821821
This form changes the information which is written to the write-ahead log
822822
to identify rows which are updated or deleted. This option has no effect
823-
except when logical replication is in use. <literal>DEFAULT</literal>
824-
(the default for non-system tables) records the
825-
old values of the columns of the primary key, if any. <literal>USING INDEX</literal>
826-
records the old values of the columns covered by the named index, which
827-
must be unique, not partial, not deferrable, and include only columns marked
828-
<literal>NOT NULL</literal>. <literal>FULL</literal> records the old values of all columns
829-
in the row. <literal>NOTHING</literal> records no information about the old row.
830-
(This is the default for system tables.)
823+
except when logical replication is in use.
831824
In all cases, no old values are logged unless at least one of the columns
832825
that would be logged differs between the old and new versions of the row.
826+
<variablelist>
827+
<varlistentry>
828+
<term><literal>DEFAULT</literal></term>
829+
<listitem>
830+
<para>
831+
Records the old values of the columns of the primary key, if any.
832+
This is the default for non-system tables.
833+
</para>
834+
</listitem>
835+
</varlistentry>
836+
837+
<varlistentry>
838+
<term><literal>USING INDEX <replaceable class="parameter">index_name</replaceable></literal></term>
839+
<listitem>
840+
<para>
841+
Records the old values of the columns covered by the named index,
842+
that must be unique, not partial, not deferrable, and include only
843+
columns marked <literal>NOT NULL</literal>. If this index is
844+
dropped, the behavior is the same as <literal>NOTHING</literal>.
845+
</para>
846+
</listitem>
847+
</varlistentry>
848+
849+
<varlistentry>
850+
<term><literal>FULL</literal></term>
851+
<listitem>
852+
<para>
853+
Records the old values of all columns in the row.
854+
</para>
855+
</listitem>
856+
</varlistentry>
857+
858+
<varlistentry>
859+
<term><literal>NOTHING</literal></term>
860+
<listitem>
861+
<para>
862+
Records no information about the old row. This is the default for
863+
system tables.
864+
</para>
865+
</listitem>
866+
</varlistentry>
867+
</variablelist>
833868
</para>
834869
</listitem>
835870
</varlistentry>

‎src/include/catalog/pg_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ typedef FormData_pg_class *Form_pg_class;
178178
/*
179179
* an explicitly chosen candidate key's columns are used as replica identity.
180180
* Note this will still be set if the index has been dropped; in that case it
181-
* has the same meaning as 'd'.
181+
* has the same meaning as 'n'.
182182
*/
183183
#defineREPLICA_IDENTITY_INDEX'i'
184184

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp