Skip to content

Commit 6ef5baf

Browse files
committed
Document that && can be used to search arrays.
Also, add some cross-links to the indexing documentation, so it's easier to notice that && and other array operators have index support. Ryan Kelly, edited by me.
1 parent 6753ced commit 6ef5baf

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/src/sgml/array.sgml

+14
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,20 @@ SELECT * FROM
573573
This function is described in <xref linkend="functions-srf-subscripts">.
574574
</para>
575575

576+
<para>
577+
You can also search an array using the <literal>&amp;&amp;</> operator,
578+
which checks whether the left operand overlaps with the right operand.
579+
For instance:
580+
581+
<programlisting>
582+
SELECT * FROM sal_emp WHERE pay_by_quarter && ARRAY[10000];
583+
</programlisting>
584+
585+
This and other array operators are further described in
586+
<xref linkend="functions-array">. It can be accelerated by an appropriate
587+
index, as described in <xref linkend="indexes-types">.
588+
</para>
589+
576590
<tip>
577591
<para>
578592
Arrays are not sets; searching for specific array elements

doc/src/sgml/func.sgml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10282,7 +10282,8 @@ SELECT NULLIF(value, '(none)') ...
1028210282

1028310283
<para>
1028410284
See <xref linkend="arrays"> for more details about array operator
10285-
behavior.
10285+
behavior. See <xref linkend="indexes-types"> for more details about
10286+
which operators support indexed operations.
1028610287
</para>
1028710288

1028810289
<para>

0 commit comments

Comments
 (0)