@@ -866,15 +866,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
866
866
<varlistentry>
867
867
<term><literal>UNIQUE</literal> (column constraint)</term>
868
868
<term><literal>UNIQUE ( <replaceable class="parameter">column_name</replaceable> [, ... ] )</literal>
869
- <optional> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...]) </optional> (table constraint)</term>
869
+ <optional> <literal> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...])</literal> </optional> (table constraint)</term>
870
870
871
871
<listitem>
872
872
<para>
873
873
The <literal>UNIQUE</literal> constraint specifies that a
874
874
group of one or more columns of a table can contain
875
- only unique values. The behavior of the unique table constraint
876
- is the same as that for column constraints, with the additional
877
- capability to span multiple columns.
875
+ only unique values. The behavior of a unique table constraint
876
+ is the same as that of a unique column constraint, with the
877
+ additional capability to span multiple columns. The constraint
878
+ therefore enforces that any two rows must differ in at least one
879
+ of these columns.
878
880
</para>
879
881
880
882
<para>
@@ -883,10 +885,10 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
883
885
</para>
884
886
885
887
<para>
886
- Each unique table constraint must name a set of columns that is
888
+ Each unique constraint should name a set of columns that is
887
889
different from the set of columns named by any other unique or
888
- primary key constraint defined for the table. (Otherwise it
889
- would just be the same constraint listed twice .)
890
+ primary key constraint defined for the table. (Otherwise, redundant
891
+ unique constraints will be discarded .)
890
892
</para>
891
893
892
894
<para>
@@ -899,10 +901,15 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
899
901
<para>
900
902
Adding a unique constraint will automatically create a unique btree
901
903
index on the column or group of columns used in the constraint.
902
- The optional clause <literal>INCLUDE</literal> adds to that index
903
- one or more columns on which the uniqueness is not enforced.
904
- Note that although the constraint is not enforced on the included columns,
905
- it still depends on them. Consequently, some operations on these columns
904
+ </para>
905
+
906
+ <para>
907
+ The optional <literal>INCLUDE</literal> clause adds to that index
908
+ one or more columns that are simply <quote>payload</quote>: uniqueness
909
+ is not enforced on them, and the index cannot be searched on the basis
910
+ of those columns. However they can be retrieved by an index-only scan.
911
+ Note that although the constraint is not enforced on included columns,
912
+ it still depends on them. Consequently, some operations on such columns
906
913
(e.g., <literal>DROP COLUMN</literal>) can cause cascaded constraint and
907
914
index deletion.
908
915
</para>
@@ -912,7 +919,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
912
919
<varlistentry>
913
920
<term><literal>PRIMARY KEY</literal> (column constraint)</term>
914
921
<term><literal>PRIMARY KEY ( <replaceable class="parameter">column_name</replaceable> [, ... ] )</literal>
915
- <optional> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...]) </optional> (table constraint)</term>
922
+ <optional> <literal> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...])</literal> </optional> (table constraint)</term>
916
923
<listitem>
917
924
<para>
918
925
The <literal>PRIMARY KEY</literal> constraint specifies that a column or
@@ -930,27 +937,34 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
930
937
931
938
<para>
932
939
<literal>PRIMARY KEY</literal> enforces the same data constraints as
933
- a combination of <literal>UNIQUE</literal> and <literal>NOT NULL</literal>, but
940
+ a combination of <literal>UNIQUE</literal> and <literal>NOT
941
+ NULL</literal>. However,
934
942
identifying a set of columns as the primary key also provides metadata
935
943
about the design of the schema, since a primary key implies that other
936
944
tables can rely on this set of columns as a unique identifier for rows.
937
945
</para>
938
946
939
947
<para>
940
- <literal>PRIMARY KEY</literal> constraints share the restrictions that
941
- <literal>UNIQUE</literal> constraints have when placed on partitioned
942
- tables .
948
+ When placed on a partitioned table, <literal>PRIMARY KEY</literal>
949
+ constraints share the restrictions previously decribed
950
+ for <literal>UNIQUE</literal> constraints .
943
951
</para>
944
952
945
953
<para>
946
954
Adding a <literal>PRIMARY KEY</literal> constraint will automatically
947
955
create a unique btree index on the column or group of columns used in the
948
- constraint. The optional <literal>INCLUDE</literal> clause allows a list
949
- of columns to be specified which will be included in the non-key portion
950
- of the index. Although uniqueness is not enforced on the included columns,
951
- the constraint still depends on them. Consequently, some operations on the
952
- included columns (e.g., <literal>DROP COLUMN</literal>) can cause cascaded
953
- constraint and index deletion.
956
+ constraint.
957
+ </para>
958
+
959
+ <para>
960
+ The optional <literal>INCLUDE</literal> clause adds to that index
961
+ one or more columns that are simply <quote>payload</quote>: uniqueness
962
+ is not enforced on them, and the index cannot be searched on the basis
963
+ of those columns. However they can be retrieved by an index-only scan.
964
+ Note that although the constraint is not enforced on included columns,
965
+ it still depends on them. Consequently, some operations on such columns
966
+ (e.g., <literal>DROP COLUMN</literal>) can cause cascaded constraint and
967
+ index deletion.
954
968
</para>
955
969
</listitem>
956
970
</varlistentry>
0 commit comments