@@ -776,15 +776,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
776
776
<varlistentry>
777
777
<term><literal>UNIQUE</literal> (column constraint)</term>
778
778
<term><literal>UNIQUE ( <replaceable class="parameter">column_name</replaceable> [, ... ] )</literal>
779
- <optional> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...]) </optional> (table constraint)</term>
779
+ <optional> <literal> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...])</literal> </optional> (table constraint)</term>
780
780
781
781
<listitem>
782
782
<para>
783
783
The <literal>UNIQUE</literal> constraint specifies that a
784
784
group of one or more columns of a table can contain
785
- only unique values. The behavior of the unique table constraint
786
- is the same as that for column constraints, with the additional
787
- capability to span multiple columns.
785
+ only unique values. The behavior of a unique table constraint
786
+ is the same as that of a unique column constraint, with the
787
+ additional capability to span multiple columns. The constraint
788
+ therefore enforces that any two rows must differ in at least one
789
+ of these columns.
788
790
</para>
789
791
790
792
<para>
@@ -793,10 +795,10 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
793
795
</para>
794
796
795
797
<para>
796
- Each unique table constraint must name a set of columns that is
798
+ Each unique constraint should name a set of columns that is
797
799
different from the set of columns named by any other unique or
798
- primary key constraint defined for the table. (Otherwise it
799
- would just be the same constraint listed twice .)
800
+ primary key constraint defined for the table. (Otherwise, redundant
801
+ unique constraints will be discarded .)
800
802
</para>
801
803
802
804
<para>
@@ -809,10 +811,15 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
809
811
<para>
810
812
Adding a unique constraint will automatically create a unique btree
811
813
index on the column or group of columns used in the constraint.
812
- The optional clause <literal>INCLUDE</literal> adds to that index
813
- one or more columns on which the uniqueness is not enforced.
814
- Note that although the constraint is not enforced on the included columns,
815
- it still depends on them. Consequently, some operations on these columns
814
+ </para>
815
+
816
+ <para>
817
+ The optional <literal>INCLUDE</literal> clause adds to that index
818
+ one or more columns that are simply <quote>payload</quote>: uniqueness
819
+ is not enforced on them, and the index cannot be searched on the basis
820
+ of those columns. However they can be retrieved by an index-only scan.
821
+ Note that although the constraint is not enforced on included columns,
822
+ it still depends on them. Consequently, some operations on such columns
816
823
(e.g., <literal>DROP COLUMN</literal>) can cause cascaded constraint and
817
824
index deletion.
818
825
</para>
@@ -822,7 +829,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
822
829
<varlistentry>
823
830
<term><literal>PRIMARY KEY</literal> (column constraint)</term>
824
831
<term><literal>PRIMARY KEY ( <replaceable class="parameter">column_name</replaceable> [, ... ] )</literal>
825
- <optional> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...]) </optional> (table constraint)</term>
832
+ <optional> <literal> INCLUDE ( <replaceable class="parameter">column_name</replaceable> [, ...])</literal> </optional> (table constraint)</term>
826
833
<listitem>
827
834
<para>
828
835
The <literal>PRIMARY KEY</literal> constraint specifies that a column or
@@ -840,27 +847,34 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
840
847
841
848
<para>
842
849
<literal>PRIMARY KEY</literal> enforces the same data constraints as
843
- a combination of <literal>UNIQUE</literal> and <literal>NOT NULL</literal>, but
850
+ a combination of <literal>UNIQUE</literal> and <literal>NOT
851
+ NULL</literal>. However,
844
852
identifying a set of columns as the primary key also provides metadata
845
853
about the design of the schema, since a primary key implies that other
846
854
tables can rely on this set of columns as a unique identifier for rows.
847
855
</para>
848
856
849
857
<para>
850
- <literal>PRIMARY KEY</literal> constraints share the restrictions that
851
- <literal>UNIQUE</literal> constraints have when placed on partitioned
852
- tables .
858
+ When placed on a partitioned table, <literal>PRIMARY KEY</literal>
859
+ constraints share the restrictions previously decribed
860
+ for <literal>UNIQUE</literal> constraints .
853
861
</para>
854
862
855
863
<para>
856
864
Adding a <literal>PRIMARY KEY</literal> constraint will automatically
857
865
create a unique btree index on the column or group of columns used in the
858
- constraint. The optional <literal>INCLUDE</literal> clause allows a list
859
- of columns to be specified which will be included in the non-key portion
860
- of the index. Although uniqueness is not enforced on the included columns,
861
- the constraint still depends on them. Consequently, some operations on the
862
- included columns (e.g., <literal>DROP COLUMN</literal>) can cause cascaded
863
- constraint and index deletion.
866
+ constraint.
867
+ </para>
868
+
869
+ <para>
870
+ The optional <literal>INCLUDE</literal> clause adds to that index
871
+ one or more columns that are simply <quote>payload</quote>: uniqueness
872
+ is not enforced on them, and the index cannot be searched on the basis
873
+ of those columns. However they can be retrieved by an index-only scan.
874
+ Note that although the constraint is not enforced on included columns,
875
+ it still depends on them. Consequently, some operations on such columns
876
+ (e.g., <literal>DROP COLUMN</literal>) can cause cascaded constraint and
877
+ index deletion.
864
878
</para>
865
879
</listitem>
866
880
</varlistentry>
0 commit comments