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

Commit861095a

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 parente1fd61c commit861095a

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
@@ -799,16 +799,51 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
799799
<para>
800800
This form changes the information which is written to the write-ahead log
801801
to identify rows which are updated or deleted. This option has no effect
802-
except when logical replication is in use. <literal>DEFAULT</literal>
803-
(the default for non-system tables) records the
804-
old values of the columns of the primary key, if any. <literal>USING INDEX</literal>
805-
records the old values of the columns covered by the named index, which
806-
must be unique, not partial, not deferrable, and include only columns marked
807-
<literal>NOT NULL</literal>. <literal>FULL</literal> records the old values of all columns
808-
in the row. <literal>NOTHING</literal> records no information about the old row.
809-
(This is the default for system tables.)
802+
except when logical replication is in use.
810803
In all cases, no old values are logged unless at least one of the columns
811804
that would be logged differs between the old and new versions of the row.
805+
<variablelist>
806+
<varlistentry>
807+
<term><literal>DEFAULT</literal></term>
808+
<listitem>
809+
<para>
810+
Records the old values of the columns of the primary key, if any.
811+
This is the default for non-system tables.
812+
</para>
813+
</listitem>
814+
</varlistentry>
815+
816+
<varlistentry>
817+
<term><literal>USING INDEX <replaceable class="parameter">index_name</replaceable></literal></term>
818+
<listitem>
819+
<para>
820+
Records the old values of the columns covered by the named index,
821+
that must be unique, not partial, not deferrable, and include only
822+
columns marked <literal>NOT NULL</literal>. If this index is
823+
dropped, the behavior is the same as <literal>NOTHING</literal>.
824+
</para>
825+
</listitem>
826+
</varlistentry>
827+
828+
<varlistentry>
829+
<term><literal>FULL</literal></term>
830+
<listitem>
831+
<para>
832+
Records the old values of all columns in the row.
833+
</para>
834+
</listitem>
835+
</varlistentry>
836+
837+
<varlistentry>
838+
<term><literal>NOTHING</literal></term>
839+
<listitem>
840+
<para>
841+
Records no information about the old row. This is the default for
842+
system tables.
843+
</para>
844+
</listitem>
845+
</varlistentry>
846+
</variablelist>
812847
</para>
813848
</listitem>
814849
</varlistentry>

‎src/include/catalog/pg_class.h

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp