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