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

Commit156475a

Browse files
committed
Revert my patch of 2009-04-04 that removed contrib/intarray's definitions of
the <@ and @> operators. These are not in fact equivalent to the built-inanyarray operators of the same names, because they have different behavior forempty arrays, namely they don't think empty arrays are contained in anything.That is mathematically wrong, no doubt, but until we can persuade GIN indexesto implement the mathematical definition we should probably not change this.Another reason for not changing it now is that we can't yet ensure theopclasses will be updated correctly in a dump-and-reload upgrade. Perrecent discussions.
1 parent32ea236 commit156475a

File tree

4 files changed

+50
-53
lines changed

4 files changed

+50
-53
lines changed

‎contrib/intarray/_int.sql.in

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/intarray/_int.sql.in,v 1.30 2009/04/05 00:40:35 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/intarray/_int.sql.in,v 1.31 2009/06/07 20:09:34 tgl Exp $ */
22

33
-- Adjust this setting to control where the objects get created.
44
SET search_path = public;
@@ -152,23 +152,23 @@ CREATE OPERATOR && (
152152
--JOIN = neqjoinsel
153153
--);
154154

155-
--CREATE OPERATOR @> (
156-
--LEFTARG = _int4,
157-
--RIGHTARG = _int4,
158-
--PROCEDURE = _int_contains,
159-
--COMMUTATOR = '<@',
160-
--RESTRICT = contsel,
161-
--JOIN = contjoinsel
162-
--);
155+
CREATE OPERATOR @> (
156+
LEFTARG = _int4,
157+
RIGHTARG = _int4,
158+
PROCEDURE = _int_contains,
159+
COMMUTATOR = '<@',
160+
RESTRICT = contsel,
161+
JOIN = contjoinsel
162+
);
163163

164-
--CREATE OPERATOR <@ (
165-
--LEFTARG = _int4,
166-
--RIGHTARG = _int4,
167-
--PROCEDURE = _int_contained,
168-
--COMMUTATOR = '@>',
169-
--RESTRICT = contsel,
170-
--JOIN = contjoinsel
171-
--);
164+
CREATE OPERATOR <@ (
165+
LEFTARG = _int4,
166+
RIGHTARG = _int4,
167+
PROCEDURE = _int_contained,
168+
COMMUTATOR = '@>',
169+
RESTRICT = contsel,
170+
JOIN = contjoinsel
171+
);
172172

173173
-- obsolete:
174174
CREATE OPERATOR @ (
@@ -365,8 +365,8 @@ CREATE OPERATOR CLASS gist__int_ops
365365
DEFAULT FOR TYPE _int4 USING gist AS
366366
OPERATOR3&&,
367367
OPERATOR6= (anyarray, anyarray),
368-
OPERATOR7@> (anyarray, anyarray),
369-
OPERATOR8<@ (anyarray, anyarray),
368+
OPERATOR7@>,
369+
OPERATOR8<@,
370370
OPERATOR13@,
371371
OPERATOR14~,
372372
OPERATOR20@@ (_int4, query_int),
@@ -442,8 +442,8 @@ FOR TYPE _int4 USING gist
442442
AS
443443
OPERATOR3&&,
444444
OPERATOR6= (anyarray, anyarray),
445-
OPERATOR7@> (anyarray, anyarray),
446-
OPERATOR8<@ (anyarray, anyarray),
445+
OPERATOR7@>,
446+
OPERATOR8<@,
447447
OPERATOR13@,
448448
OPERATOR14~,
449449
OPERATOR20@@ (_int4, query_int),
@@ -473,8 +473,8 @@ FOR TYPE _int4 USING gin
473473
AS
474474
OPERATOR3&&,
475475
OPERATOR6= (anyarray, anyarray),
476-
OPERATOR7@> (anyarray, anyarray),
477-
OPERATOR8<@ (anyarray, anyarray),
476+
OPERATOR7@>,
477+
OPERATOR8<@,
478478
OPERATOR13@,
479479
OPERATOR14~,
480480
OPERATOR20@@ (_int4, query_int),

‎contrib/intarray/uninstall__int.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/intarray/uninstall__int.sql,v 1.11 2009/04/05 00:40:35 tgl Exp $*/
1+
/* $PostgreSQL: pgsql/contrib/intarray/uninstall__int.sql,v 1.12 2009/06/07 20:09:34 tgl Exp $*/
22

33
-- Adjust this setting to control where the objects get created.
44
SET search_path= public;
@@ -91,6 +91,10 @@ DROP FUNCTION icount(_int4);
9191

9292
DROPFUNCTION intset(int4);
9393

94+
DROPOPERATOR<@ (_int4, _int4);
95+
96+
DROPOPERATOR @> (_int4, _int4);
97+
9498
DROPOPERATOR ~ (_int4, _int4);
9599

96100
DROPOPERATOR @ (_int4, _int4);

‎doc/src/sgml/intarray.sgml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/intarray.sgml,v 1.7 2009/04/05 00:40:35 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/intarray.sgml,v 1.8 2009/06/07 20:09:34 tgl Exp $ -->
22

33
<sect1 id="intarray">
44
<title>intarray</title>
@@ -134,12 +134,12 @@
134134
<entry>overlap &mdash; <literal>true</> if arrays have at least one common element</entry>
135135
</row>
136136
<row>
137-
<entry><literal>int[] @ int[]</literal></entry>
137+
<entry><literal>int[] @&gt; int[]</literal></entry>
138138
<entry><type>boolean</type></entry>
139139
<entry>contains &mdash; <literal>true</> if left array contains right array</entry>
140140
</row>
141141
<row>
142-
<entry><literal>int[]~ int[]</literal></entry>
142+
<entry><literal>int[]&lt;@ int[]</literal></entry>
143143
<entry><type>boolean</type></entry>
144144
<entry>contained &mdash; <literal>true</> if left array is contained in right array</entry>
145145
</row>
@@ -203,13 +203,22 @@
203203
</table>
204204

205205
<para>
206-
The containment operators <literal>@</> and <literal>~</> are functionally
207-
equivalent to <productname>PostgreSQL</>'s built-in operators
208-
<literal>@&gt;</> and <literal>&lt;@</>, respectively, except that
209-
<literal>@</> and <literal>~</> work only on integer arrays. These
210-
operator names are deprecated and will eventually be retired. (Notice that
211-
these names are reversed from the convention formerly followed by the core
212-
geometric datatypes!)
206+
(Before PostgreSQL 8.2, the containment operators <literal>@&gt;</> and
207+
<literal>&lt;@</> were respectively called <literal>@</> and <literal>~</>.
208+
These names are still available, but are deprecated and will eventually be
209+
retired. Notice that the old names are reversed from the convention
210+
formerly followed by the core geometric datatypes!)
211+
</para>
212+
213+
<para>
214+
The containment operators <literal>@&gt;</> and <literal>&lt;@</> are
215+
approximately equivalent to <productname>PostgreSQL</>'s built-in operators
216+
of the same names, except that they work only on integer arrays while the
217+
built-in operators work for any array type. An important difference is
218+
that <filename>intarray</>'s operators do not consider an empty array to be
219+
contained in anything else. This is consistent with the behavior of
220+
GIN-indexed queries, but not with the usual mathematical definition of
221+
containment.
213222
</para>
214223

215224
<para>
@@ -230,10 +239,8 @@
230239

231240
<para>
232241
<filename>intarray</> provides index support for the
233-
<literal>&amp;&amp;</>, <literal>@</>, <literal>~</>,
234-
and <literal>@@</> operators, as well as regular array equality
235-
and the built-in <literal>@&gt;</> and <literal>&lt;@</> operators
236-
(when used on integer arrays).
242+
<literal>&amp;&amp;</>, <literal>@&gt;</>, <literal>&lt;@</>,
243+
and <literal>@@</> operators, as well as regular array equality.
237244
</para>
238245

239246
<para>

‎doc/src/sgml/release-8.4.sgml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/release-8.4.sgml,v 1.7 2009/05/27 22:12:53 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/release-8.4.sgml,v 1.8 2009/06/07 20:09:34 tgl Exp $ -->
22
<!-- See header comment in release.sgml about typical markup -->
33

44
<sect1 id="release-8-4">
@@ -3321,20 +3321,6 @@
33213321
</para>
33223322
</listitem>
33233323

3324-
<listitem>
3325-
<para>
3326-
Remove <filename>contrib/intarray</>'s definitions of the
3327-
<literal>&lt;@</> and <literal>@&gt;</> operators (Tom)
3328-
</para>
3329-
3330-
<para>
3331-
This avoids confusion with the equivalent built-in operators.
3332-
If needed, the <filename>contrib/intarray</> implementations
3333-
are still available under their historical names <literal>@</>
3334-
and <literal>~</>.
3335-
</para>
3336-
</listitem>
3337-
33383324
<listitem>
33393325
<para>
33403326
Make <filename>contrib/pg_standby</> recover all available WAL before

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp