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