Skip to content

Commit c7aaa04

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 8dfc7d8 commit c7aaa04

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
@@ -697,15 +697,6 @@ CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
697697
</programlisting>
698698
</para>
699699

700-
<para>
701-
Expression indexes also allow control over the scope of unique indexes.
702-
For example, this unique index prevents duplicate integer values from
703-
being stored in a <type>double precision</type>-typed column:
704-
<programlisting>
705-
CREATE UNIQUE INDEX test1_uniq_int ON tests ((floor(double_col)))
706-
</programlisting>
707-
</para>
708-
709700
<para>
710701
If we were to declare this index <literal>UNIQUE</>, it would prevent
711702
creation of rows whose <literal>col1</> values differ only in case,
@@ -943,18 +934,11 @@ CREATE UNIQUE INDEX tests_success_constraint ON tests (subject, target)
943934
WHERE success;
944935
</programlisting>
945936
This is a particularly efficient approach when there are few
946-
successful tests and many unsuccessful ones.
937+
successful tests and many unsuccessful ones. It is also possible to
938+
allow only one null in a column by creating a unique partial index
939+
with an <literal>IS NULL</literal> restriction.
947940
</para>
948941

949-
<para>
950-
This index allows only one null in the indexed column by using a
951-
partial index clause to process only null column values, and using
952-
an expression index clause to index <literal>true</literal> instead
953-
of <literal>null</literal>:
954-
<programlisting>
955-
CREATE UNIQUE INDEX tests_target_one_null ON tests ((target IS NULL)) WHERE target IS NULL;
956-
</programlisting>
957-
</para>
958942
</example>
959943

960944
<para>

0 commit comments

Comments
 (0)