Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c20fd08

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 449e14a commit c20fd08

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

doc/src/sgml/indices.sgml

+3-19
Original file line numberDiff line numberDiff line change
@@ -704,15 +704,6 @@ CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
704704
</programlisting>
705705
</para>
706706

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

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

969953
<para>

0 commit comments

Comments
 (0)