doc_nulls_not_distinct_v2.patch
application/octet-stream
Filename: doc_nulls_not_distinct_v2.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| doc/src/sgml/indices.sgml | 7 | 4 |
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 0c3fcfd62f..c0e3b36647 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -664,16 +664,19 @@ CREATE INDEX test3_desc_index ON test3 (id DESC NULLS LAST);
Indexes can also be used to enforce uniqueness of a column's value,
or the uniqueness of the combined values of more than one column.
<synopsis>
-CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable> (<replaceable>column</replaceable> <optional>, ...</optional>);
+CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</replaceable> (<replaceable>column</replaceable> <optional>, ...</optional>) <optional>NULLS <optional>NOT</optional> DISTINCT</optional>;
</synopsis>
Currently, only B-tree indexes can be declared unique.
</para>
<para>
When an index is declared unique, multiple table rows with equal
- indexed values are not allowed. Null values are not considered
- equal. A multicolumn unique index will only reject cases where all
- indexed columns are equal in multiple rows.
+ indexed values are not allowed. By default, null values in a unique column
+ are not considered equal, allowing multiple nulls in the column. Use
+ <literal>NULLS NOT DISTINCT</literal> to treat nulls as equal, thus
+ allowing only a single null value in an indexed column. A multicolumn
+ unique index will only reject cases where all indexed columns are equal in
+ multiple rows.
</para>
<para>