Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7cd99d3

Browse files
committed
Doc: clarify handling of duplicate elements in array containment tests.
The array <@ and @> operators do not worry about duplicates: if everymember of array X matches some element of array Y, then X is containedin Y, even if several members of X get matched to the same Y member.This was not explicitly stated in the docs though, so improve matters.Discussion:https://postgr.es/m/156614120484.1310.310161642239149585@wrigleys.postgresql.org
1 parent8873c5b commit7cd99d3

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

‎doc/src/sgml/func.sgml‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12733,14 +12733,14 @@ SELECT NULLIF(value, '(none)') ...
1273312733
<row>
1273412734
<entry> <literal>@&gt;</literal> </entry>
1273512735
<entry>contains</entry>
12736-
<entry><literal>ARRAY[1,4,3] @&gt; ARRAY[3,1]</literal></entry>
12736+
<entry><literal>ARRAY[1,4,3] @&gt; ARRAY[3,1,3]</literal></entry>
1273712737
<entry><literal>t</literal></entry>
1273812738
</row>
1273912739

1274012740
<row>
1274112741
<entry> <literal>&lt;@</literal> </entry>
1274212742
<entry>is contained by</entry>
12743-
<entry><literal>ARRAY[2,7] &lt;@ ARRAY[1,7,4,2,6]</literal></entry>
12743+
<entry><literal>ARRAY[2,2,7] &lt;@ ARRAY[1,7,4,2,6]</literal></entry>
1274412744
<entry><literal>t</literal></entry>
1274512745
</row>
1274612746

@@ -12783,8 +12783,10 @@ SELECT NULLIF(value, '(none)') ...
1278312783
</table>
1278412784

1278512785
<para>
12786-
Array comparisons compare the array contents element-by-element,
12787-
using the default B-tree comparison function for the element data type.
12786+
The array ordering operators (<literal>&lt;</literal>,
12787+
<literal>&gt;=</literal>, etc) compare the array contents
12788+
element-by-element, using the default B-tree comparison function for
12789+
the element data type, and sort based on the first difference.
1278812790
In multidimensional arrays the elements are visited in row-major order
1278912791
(last subscript varies most rapidly).
1279012792
If the contents of two arrays are equal but the dimensionality is
@@ -12795,6 +12797,15 @@ SELECT NULLIF(value, '(none)') ...
1279512797
number of dimensions or subscript ranges were different.)
1279612798
</para>
1279712799

12800+
<para>
12801+
The array containment operators (<literal>&lt;@</literal>
12802+
and <literal>@&gt;</literal>) consider one array to be contained in
12803+
another one if each of its elements appears in the other one.
12804+
Duplicates are not treated specially, thus <literal>ARRAY[1]</literal>
12805+
and <literal>ARRAY[1,1]</literal> are each considered to contain the
12806+
other.
12807+
</para>
12808+
1279812809
<para>
1279912810
See <xref linkend="arrays"/> for more details about array operator
1280012811
behavior. See <xref linkend="indexes-types"/> for more details about

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp