Skip to content

Commit 388d7f8

Browse files
committed
doc: Simplify mention of unique indexes for NULL control
Discussion: https://postgr.es/m/2304.1586532634@sss.pgh.pa.us Backpatch-through: 9.5
1 parent 089baec commit 388d7f8

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

doc/src/sgml/indices.sgml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -705,15 +705,6 @@ CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
705705
</programlisting>
706706
</para>
707707

708-
<para>
709-
Expression indexes also allow control over the scope of unique indexes.
710-
For example, this unique index prevents duplicate integer values from
711-
being stored in a <type>double precision</type>-typed column:
712-
<programlisting>
713-
CREATE UNIQUE INDEX test1_uniq_int ON tests ((floor(double_col)))
714-
</programlisting>
715-
</para>
716-
717708
<para>
718709
If we were to declare this index <literal>UNIQUE</literal>, it would prevent
719710
creation of rows whose <literal>col1</literal> values differ only in case,
@@ -953,18 +944,11 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
953944
WHERE success;
954945
</programlisting>
955946
This is a particularly efficient approach when there are few
956-
successful tests and many unsuccessful ones.
947+
successful tests and many unsuccessful ones. It is also possible to
948+
allow only one null in a column by creating a unique partial index
949+
with an <literal>IS NULL</literal> restriction.
957950
</para>
958951

959-
<para>
960-
This index allows only one null in the indexed column by using a
961-
partial index clause to process only null column values, and using
962-
an expression index clause to index <literal>true</literal> instead
963-
of <literal>null</literal>:
964-
<programlisting>
965-
CREATE UNIQUE INDEX tests_target_one_null ON tests ((target IS NULL)) WHERE target IS NULL;
966-
</programlisting>
967-
</para>
968952
</example>
969953

970954
<para>

0 commit comments

Comments
 (0)