File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -705,15 +705,6 @@ CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));
705
705
</programlisting>
706
706
</para>
707
707
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
-
717
708
<para>
718
709
If we were to declare this index <literal>UNIQUE</literal>, it would prevent
719
710
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)
953
944
WHERE success;
954
945
</programlisting>
955
946
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.
957
950
</para>
958
951
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>
968
952
</example>
969
953
970
954
<para>
You can’t perform that action at this time.
0 commit comments