Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
684ad6a9
Commit
684ad6a9
authored
Sep 10, 2006
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename contrib contains/contained-by operators to @> and <@, per discussion.
parent
ba920e1c
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
1290 additions
and
1111 deletions
+1290
-1111
contrib/cube/README.cube
contrib/cube/README.cube
+8
-2
contrib/cube/cube.c
contrib/cube/cube.c
+5
-1
contrib/cube/cube.sql.in
contrib/cube/cube.sql.in
+17
-2
contrib/cube/expected/cube.out
contrib/cube/expected/cube.out
+30
-30
contrib/cube/expected/cube_1.out
contrib/cube/expected/cube_1.out
+30
-30
contrib/cube/expected/cube_2.out
contrib/cube/expected/cube_2.out
+30
-30
contrib/cube/sql/cube.sql
contrib/cube/sql/cube.sql
+30
-30
contrib/cube/uninstall_cube.sql
contrib/cube/uninstall_cube.sql
+4
-0
contrib/earthdistance/README.earthdistance
contrib/earthdistance/README.earthdistance
+1
-1
contrib/earthdistance/expected/earthdistance.out
contrib/earthdistance/expected/earthdistance.out
+16
-16
contrib/earthdistance/sql/earthdistance.sql
contrib/earthdistance/sql/earthdistance.sql
+16
-16
contrib/hstore/README.hstore
contrib/hstore/README.hstore
+11
-5
contrib/hstore/expected/hstore.out
contrib/hstore/expected/hstore.out
+22
-21
contrib/hstore/hstore.sql.in
contrib/hstore/hstore.sql.in
+28
-7
contrib/hstore/sql/hstore.sql
contrib/hstore/sql/hstore.sql
+24
-16
contrib/intarray/README.intarray
contrib/intarray/README.intarray
+14
-8
contrib/intarray/_int.sql.in
contrib/intarray/_int.sql.in
+45
-20
contrib/intarray/_int_gin.c
contrib/intarray/_int_gin.c
+2
-0
contrib/intarray/_int_gist.c
contrib/intarray/_int_gist.c
+2
-0
contrib/intarray/_intbig_gist.c
contrib/intarray/_intbig_gist.c
+2
-0
contrib/intarray/expected/_int.out
contrib/intarray/expected/_int.out
+14
-18
contrib/intarray/sql/_int.sql
contrib/intarray/sql/_int.sql
+14
-12
contrib/intarray/uninstall__int.sql
contrib/intarray/uninstall__int.sql
+10
-0
contrib/seg/README.seg
contrib/seg/README.seg
+8
-2
contrib/seg/expected/seg.out
contrib/seg/expected/seg.out
+19
-20
contrib/seg/expected/seg_1.out
contrib/seg/expected/seg_1.out
+19
-20
contrib/seg/seg.c
contrib/seg/seg.c
+4
-0
contrib/seg/seg.sql.in
contrib/seg/seg.sql.in
+23
-2
contrib/seg/sql/seg.sql
contrib/seg/sql/seg.sql
+19
-17
contrib/seg/uninstall_seg.sql
contrib/seg/uninstall_seg.sql
+4
-0
contrib/tsearch2/expected/tsearch2.out
contrib/tsearch2/expected/tsearch2.out
+738
-752
contrib/tsearch2/query_gist.c
contrib/tsearch2/query_gist.c
+21
-4
contrib/tsearch2/sql/tsearch2.sql
contrib/tsearch2/sql/tsearch2.sql
+23
-21
contrib/tsearch2/tsearch.sql.in
contrib/tsearch2/tsearch.sql.in
+23
-2
contrib/tsearch2/untsearch.sql.in
contrib/tsearch2/untsearch.sql.in
+11
-3
doc/src/sgml/ref/create_opclass.sgml
doc/src/sgml/ref/create_opclass.sgml
+3
-3
No files found.
contrib/cube/README.cube
View file @
684ad6a9
...
@@ -201,14 +201,20 @@ a && b Overlaps
...
@@ -201,14 +201,20 @@ a && b Overlaps
The cubements a and b overlap.
The cubements a and b overlap.
a @ b Contains
a @
>
b Contains
The cubement a contains the cubement b.
The cubement a contains the cubement b.
a
~
b Contained in
a
<@
b Contained in
The cubement a is contained in b.
The cubement a is contained in b.
(Before PostgreSQL 8.2, the containment operators @> and <@ were
respectively called @ and ~. These names are still available, but are
deprecated and will eventually be retired. Notice that the old names
are reversed from the convention formerly followed by the core geometric
datatypes!)
Although the mnemonics of the following operators is questionable, I
Although the mnemonics of the following operators is questionable, I
preserved them to maintain visual consistency with other geometric
preserved them to maintain visual consistency with other geometric
data types defined in Postgres.
data types defined in Postgres.
...
...
contrib/cube/cube.c
View file @
684ad6a9
/******************************************************************************
/******************************************************************************
$PostgreSQL: pgsql/contrib/cube/cube.c,v 1.2
8 2006/07/27 21:55:09
tgl Exp $
$PostgreSQL: pgsql/contrib/cube/cube.c,v 1.2
9 2006/09/10 17:36:50
tgl Exp $
This file contains routines that can be bound to a Postgres backend and
This file contains routines that can be bound to a Postgres backend and
called by the backend in the process of processing queries. The calling
called by the backend in the process of processing queries. The calling
...
@@ -689,9 +689,11 @@ g_cube_leaf_consistent(NDBOX * key,
...
@@ -689,9 +689,11 @@ g_cube_leaf_consistent(NDBOX * key,
retval
=
(
bool
)
(
cube_cmp_v0
(
key
,
query
)
==
0
);
retval
=
(
bool
)
(
cube_cmp_v0
(
key
,
query
)
==
0
);
break
;
break
;
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
retval
=
(
bool
)
cube_contains_v0
(
key
,
query
);
retval
=
(
bool
)
cube_contains_v0
(
key
,
query
);
break
;
break
;
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
retval
=
(
bool
)
cube_contains_v0
(
query
,
key
);
retval
=
(
bool
)
cube_contains_v0
(
query
,
key
);
break
;
break
;
default:
default:
...
@@ -717,9 +719,11 @@ g_cube_internal_consistent(NDBOX * key,
...
@@ -717,9 +719,11 @@ g_cube_internal_consistent(NDBOX * key,
break
;
break
;
case
RTSameStrategyNumber
:
case
RTSameStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
retval
=
(
bool
)
cube_contains_v0
(
key
,
query
);
retval
=
(
bool
)
cube_contains_v0
(
key
,
query
);
break
;
break
;
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
retval
=
(
bool
)
cube_overlap_v0
(
key
,
query
);
retval
=
(
bool
)
cube_overlap_v0
(
key
,
query
);
break
;
break
;
default:
default:
...
...
contrib/cube/cube.sql.in
View file @
684ad6a9
...
@@ -243,6 +243,19 @@ CREATE OPERATOR <> (
...
@@ -243,6 +243,19 @@ CREATE OPERATOR <> (
RESTRICT = neqsel, JOIN = neqjoinsel
RESTRICT = neqsel, JOIN = neqjoinsel
);
);
CREATE OPERATOR @> (
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contains,
COMMUTATOR = '<@',
RESTRICT = contsel, JOIN = contjoinsel
);
CREATE OPERATOR <@ (
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contained,
COMMUTATOR = '@>',
RESTRICT = contsel, JOIN = contjoinsel
);
-- these are obsolete/deprecated:
CREATE OPERATOR @ (
CREATE OPERATOR @ (
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contains,
LEFTARG = cube, RIGHTARG = cube, PROCEDURE = cube_contains,
COMMUTATOR = '~',
COMMUTATOR = '~',
...
@@ -308,8 +321,10 @@ CREATE OPERATOR CLASS gist_cube_ops
...
@@ -308,8 +321,10 @@ CREATE OPERATOR CLASS gist_cube_ops
DEFAULT FOR TYPE cube USING gist AS
DEFAULT FOR TYPE cube USING gist AS
OPERATOR 3 && ,
OPERATOR 3 && ,
OPERATOR 6 = ,
OPERATOR 6 = ,
OPERATOR 7 @ ,
OPERATOR 7 @> ,
OPERATOR 8 ~ ,
OPERATOR 8 <@ ,
OPERATOR 13 @ ,
OPERATOR 14 ~ ,
FUNCTION 1 g_cube_consistent (internal, cube, int4),
FUNCTION 1 g_cube_consistent (internal, cube, int4),
FUNCTION 2 g_cube_union (internal, internal),
FUNCTION 2 g_cube_union (internal, internal),
FUNCTION 3 g_cube_compress (internal),
FUNCTION 3 g_cube_compress (internal),
...
...
contrib/cube/expected/cube.out
View file @
684ad6a9
...
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
...
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
-- "contained in" (the left operand is the cube entirely enclosed by
-- "contained in" (the left operand is the cube entirely enclosed by
-- the right operand):
-- the right operand):
--
--
SELECT '0'::cube
~
'0'::cube AS bool;
SELECT '0'::cube
<@
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube
~
'0,0,0'::cube AS bool;
SELECT '0,0,0'::cube
<@
'0,0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '0,0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '1,0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '1,0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(-1,-1,-1),(1,1,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(-1,-1,-1),(1,1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(-1,-1,-1,-1),(1,1,1,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(-1,-1,-1,-1),(1,1,1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '0'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '1'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '-1'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube
~
'(-1,-1),(1,1)'::cube AS bool;
SELECT '(-1),(1)'::cube
<@
'(-1,-1),(1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-2),(1)'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '(-2),(1)'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(-2),(1)'::cube
~
'(-1,-1),(1,1)'::cube AS bool;
SELECT '(-2),(1)'::cube
<@
'(-1,-1),(1,1)'::cube AS bool;
bool
bool
------
------
f
f
...
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube ~ '(-1,-1),(1,1)'::cube AS bool;
...
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube ~ '(-1,-1),(1,1)'::cube AS bool;
-- "contains" (the left operand is the cube that entirely encloses the
-- "contains" (the left operand is the cube that entirely encloses the
-- right operand)
-- right operand)
--
--
SELECT '0'::cube @ '0'::cube AS bool;
SELECT '0'::cube @
>
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube @ '0,0,0'::cube AS bool;
SELECT '0,0,0'::cube @
>
'0,0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '0,0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'0,0,0'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '1,0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'1,0,0'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1,-1),(1,1,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(-1,-1,-1),(1,1,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '0'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '1'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '-1'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'-1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '(-1),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1),(1,1)'::cube @ '(-1),(1)'::cube AS bool;
SELECT '(-1,-1),(1,1)'::cube @
>
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '(-2),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'(-2),(1)'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(-1,-1),(1,1)'::cube @ '(-2),(1)'::cube AS bool;
SELECT '(-1,-1),(1,1)'::cube @
>
'(-2),(1)'::cube AS bool;
bool
bool
------
------
f
f
...
...
contrib/cube/expected/cube_1.out
View file @
684ad6a9
...
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
...
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
-- "contained in" (the left operand is the cube entirely enclosed by
-- "contained in" (the left operand is the cube entirely enclosed by
-- the right operand):
-- the right operand):
--
--
SELECT '0'::cube
~
'0'::cube AS bool;
SELECT '0'::cube
<@
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube
~
'0,0,0'::cube AS bool;
SELECT '0,0,0'::cube
<@
'0,0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '0,0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '1,0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '1,0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(-1,-1,-1),(1,1,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(-1,-1,-1),(1,1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(-1,-1,-1,-1),(1,1,1,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(-1,-1,-1,-1),(1,1,1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '0'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '1'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '-1'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube
~
'(-1,-1),(1,1)'::cube AS bool;
SELECT '(-1),(1)'::cube
<@
'(-1,-1),(1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-2),(1)'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '(-2),(1)'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(-2),(1)'::cube
~
'(-1,-1),(1,1)'::cube AS bool;
SELECT '(-2),(1)'::cube
<@
'(-1,-1),(1,1)'::cube AS bool;
bool
bool
------
------
f
f
...
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube ~ '(-1,-1),(1,1)'::cube AS bool;
...
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube ~ '(-1,-1),(1,1)'::cube AS bool;
-- "contains" (the left operand is the cube that entirely encloses the
-- "contains" (the left operand is the cube that entirely encloses the
-- right operand)
-- right operand)
--
--
SELECT '0'::cube @ '0'::cube AS bool;
SELECT '0'::cube @
>
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube @ '0,0,0'::cube AS bool;
SELECT '0,0,0'::cube @
>
'0,0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '0,0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'0,0,0'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '1,0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'1,0,0'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1,-1),(1,1,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(-1,-1,-1),(1,1,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '0'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '1'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '-1'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'-1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '(-1),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1),(1,1)'::cube @ '(-1),(1)'::cube AS bool;
SELECT '(-1,-1),(1,1)'::cube @
>
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '(-2),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'(-2),(1)'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(-1,-1),(1,1)'::cube @ '(-2),(1)'::cube AS bool;
SELECT '(-1,-1),(1,1)'::cube @
>
'(-2),(1)'::cube AS bool;
bool
bool
------
------
f
f
...
...
contrib/cube/expected/cube_2.out
View file @
684ad6a9
...
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
...
@@ -627,91 +627,91 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
-- "contained in" (the left operand is the cube entirely enclosed by
-- "contained in" (the left operand is the cube entirely enclosed by
-- the right operand):
-- the right operand):
--
--
SELECT '0'::cube
~
'0'::cube AS bool;
SELECT '0'::cube
<@
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube
~
'0,0,0'::cube AS bool;
SELECT '0,0,0'::cube
<@
'0,0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '0,0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '1,0,0'::cube
~
'0,0,1'::cube AS bool;
SELECT '1,0,0'::cube
<@
'0,0,1'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(-1,-1,-1),(1,1,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(-1,-1,-1),(1,1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube
~
'(-1,-1,-1,-1),(1,1,1,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube
<@
'(-1,-1,-1,-1),(1,1,1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '0'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '1'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '-1'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube
~
'(-1,-1),(1,1)'::cube AS bool;
SELECT '(-1),(1)'::cube
<@
'(-1,-1),(1,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-2),(1)'::cube
~
'(-1),(1)'::cube AS bool;
SELECT '(-2),(1)'::cube
<@
'(-1),(1)'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(-2),(1)'::cube
~
'(-1,-1),(1,1)'::cube AS bool;
SELECT '(-2),(1)'::cube
<@
'(-1,-1),(1,1)'::cube AS bool;
bool
bool
------
------
f
f
...
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube ~ '(-1,-1),(1,1)'::cube AS bool;
...
@@ -720,91 +720,91 @@ SELECT '(-2),(1)'::cube ~ '(-1,-1),(1,1)'::cube AS bool;
-- "contains" (the left operand is the cube that entirely encloses the
-- "contains" (the left operand is the cube that entirely encloses the
-- right operand)
-- right operand)
--
--
SELECT '0'::cube @ '0'::cube AS bool;
SELECT '0'::cube @
>
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,0'::cube @ '0,0,0'::cube AS bool;
SELECT '0,0,0'::cube @
>
'0,0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'0,0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '0,0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'0,0,0'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '0,0,1'::cube @ '1,0,0'::cube AS bool;
SELECT '0,0,1'::cube @
>
'1,0,0'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(1,0,0),(0,0,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(1,0,0),(0,0,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1,-1),(1,1,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(-1,-1,-1),(1,1,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube @ '(1,0,0),(0,0,1)'::cube AS bool;
SELECT '(-1,-1,-1,-1),(1,1,1,1)'::cube @
>
'(1,0,0),(0,0,1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '0'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'0'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '1'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '-1'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'-1'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '(-1),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1,-1),(1,1)'::cube @ '(-1),(1)'::cube AS bool;
SELECT '(-1,-1),(1,1)'::cube @
>
'(-1),(1)'::cube AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '(-1),(1)'::cube @ '(-2),(1)'::cube AS bool;
SELECT '(-1),(1)'::cube @
>
'(-2),(1)'::cube AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '(-1,-1),(1,1)'::cube @ '(-2),(1)'::cube AS bool;
SELECT '(-1,-1),(1,1)'::cube @
>
'(-2),(1)'::cube AS bool;
bool
bool
------
------
f
f
...
...
contrib/cube/sql/cube.sql
View file @
684ad6a9
...
@@ -180,41 +180,41 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
...
@@ -180,41 +180,41 @@ SELECT '[(-1,-1,-1),(1,1,1)]'::cube && '[(2,1,1),(2,2,2)]'::cube AS bool;
-- "contained in" (the left operand is the cube entirely enclosed by
-- "contained in" (the left operand is the cube entirely enclosed by
-- the right operand):
-- the right operand):
--
--
SELECT
'0'
::
cube
~
'0'
::
cube
AS
bool
;
SELECT
'0'
::
cube
<@
'0'
::
cube
AS
bool
;
SELECT
'0,0,0'
::
cube
~
'0,0,0'
::
cube
AS
bool
;
SELECT
'0,0,0'
::
cube
<@
'0,0,0'
::
cube
AS
bool
;
SELECT
'0,0'
::
cube
~
'0,0,1'
::
cube
AS
bool
;
SELECT
'0,0'
::
cube
<@
'0,0,1'
::
cube
AS
bool
;
SELECT
'0,0,0'
::
cube
~
'0,0,1'
::
cube
AS
bool
;
SELECT
'0,0,0'
::
cube
<@
'0,0,1'
::
cube
AS
bool
;
SELECT
'1,0,0'
::
cube
~
'0,0,1'
::
cube
AS
bool
;
SELECT
'1,0,0'
::
cube
<@
'0,0,1'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
~
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
<@
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
~
'(-1,-1,-1),(1,1,1)'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
<@
'(-1,-1,-1),(1,1,1)'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
~
'(-1,-1,-1,-1),(1,1,1,1)'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
<@
'(-1,-1,-1,-1),(1,1,1,1)'
::
cube
AS
bool
;
SELECT
'0'
::
cube
~
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'0'
::
cube
<@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'1'
::
cube
~
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'1'
::
cube
<@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'-1'
::
cube
~
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'-1'
::
cube
<@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
~
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
<@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
~
'(-1,-1),(1,1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
<@
'(-1,-1),(1,1)'
::
cube
AS
bool
;
SELECT
'(-2),(1)'
::
cube
~
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-2),(1)'
::
cube
<@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-2),(1)'
::
cube
~
'(-1,-1),(1,1)'
::
cube
AS
bool
;
SELECT
'(-2),(1)'
::
cube
<@
'(-1,-1),(1,1)'
::
cube
AS
bool
;
-- "contains" (the left operand is the cube that entirely encloses the
-- "contains" (the left operand is the cube that entirely encloses the
-- right operand)
-- right operand)
--
--
SELECT
'0'
::
cube
@
'0'
::
cube
AS
bool
;
SELECT
'0'
::
cube
@
>
'0'
::
cube
AS
bool
;
SELECT
'0,0,0'
::
cube
@
'0,0,0'
::
cube
AS
bool
;
SELECT
'0,0,0'
::
cube
@
>
'0,0,0'
::
cube
AS
bool
;
SELECT
'0,0,1'
::
cube
@
'0,0'
::
cube
AS
bool
;
SELECT
'0,0,1'
::
cube
@
>
'0,0'
::
cube
AS
bool
;
SELECT
'0,0,1'
::
cube
@
'0,0,0'
::
cube
AS
bool
;
SELECT
'0,0,1'
::
cube
@
>
'0,0,0'
::
cube
AS
bool
;
SELECT
'0,0,1'
::
cube
@
'1,0,0'
::
cube
AS
bool
;
SELECT
'0,0,1'
::
cube
@
>
'1,0,0'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
@
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(1,0,0),(0,0,1)'
::
cube
@
>
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(-1,-1,-1),(1,1,1)'
::
cube
@
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(-1,-1,-1),(1,1,1)'
::
cube
@
>
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(-1,-1,-1,-1),(1,1,1,1)'
::
cube
@
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(-1,-1,-1,-1),(1,1,1,1)'
::
cube
@
>
'(1,0,0),(0,0,1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
'0'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
>
'0'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
'1'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
>
'1'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
'-1'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
>
'-1'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
>
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1,-1),(1,1)'
::
cube
@
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1,-1),(1,1)'
::
cube
@
>
'(-1),(1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
'(-2),(1)'
::
cube
AS
bool
;
SELECT
'(-1),(1)'
::
cube
@
>
'(-2),(1)'
::
cube
AS
bool
;
SELECT
'(-1,-1),(1,1)'
::
cube
@
'(-2),(1)'
::
cube
AS
bool
;
SELECT
'(-1,-1),(1,1)'
::
cube
@
>
'(-2),(1)'
::
cube
AS
bool
;
-- Test of distance function
-- Test of distance function
--
--
...
...
contrib/cube/uninstall_cube.sql
View file @
684ad6a9
...
@@ -22,6 +22,10 @@ DROP OPERATOR ~ (cube, cube);
...
@@ -22,6 +22,10 @@ DROP OPERATOR ~ (cube, cube);
DROP
OPERATOR
@
(
cube
,
cube
);
DROP
OPERATOR
@
(
cube
,
cube
);
DROP
OPERATOR
<@
(
cube
,
cube
);
DROP
OPERATOR
@>
(
cube
,
cube
);
DROP
OPERATOR
<>
(
cube
,
cube
);
DROP
OPERATOR
<>
(
cube
,
cube
);
DROP
OPERATOR
=
(
cube
,
cube
);
DROP
OPERATOR
=
(
cube
,
cube
);
...
...
contrib/earthdistance/README.earthdistance
View file @
684ad6a9
...
@@ -78,7 +78,7 @@ earth_distance(earth, earth) - Returns the great circle distance between
...
@@ -78,7 +78,7 @@ earth_distance(earth, earth) - Returns the great circle distance between
two points on the surface of the Earth.
two points on the surface of the Earth.
earth_box(earth, float8) - Returns a box suitable for an indexed search using
earth_box(earth, float8) - Returns a box suitable for an indexed search using
the cube @ operator for points within a given great circle distance of a
the cube @
>
operator for points within a given great circle distance of a
location. Some points in this box are further than the specified great circle
location. Some points in this box are further than the specified great circle
distance from the location so a second check using earth_distance should be
distance from the location so a second check using earth_distance should be
made at the same time.
made at the same time.
...
...
contrib/earthdistance/expected/earthdistance.out
View file @
684ad6a9
...
@@ -743,7 +743,7 @@ SELECT cube_ll_coord(earth_box(ll_to_earth(0,0),10*earth()),1)::numeric(20,5),
...
@@ -743,7 +743,7 @@ SELECT cube_ll_coord(earth_box(ll_to_earth(0,0),10*earth()),1)::numeric(20,5),
-- Test for points that should be in bounding boxes.
-- Test for points that should be in bounding boxes.
--
--
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*1.00001) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*1.00001) @
>
ll_to_earth(0,1);
ll_to_earth(0,1);
?column?
?column?
----------
----------
...
@@ -751,7 +751,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -751,7 +751,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*1.00001) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*1.00001) @
>
ll_to_earth(0,0.1);
ll_to_earth(0,0.1);
?column?
?column?
----------
----------
...
@@ -759,7 +759,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -759,7 +759,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*1.00001) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*1.00001) @
>
ll_to_earth(0,0.01);
ll_to_earth(0,0.01);
?column?
?column?
----------
----------
...
@@ -767,7 +767,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -767,7 +767,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*1.00001) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*1.00001) @
>
ll_to_earth(0,0.001);
ll_to_earth(0,0.001);
?column?
?column?
----------
----------
...
@@ -775,7 +775,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -775,7 +775,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*1.00001) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*1.00001) @
>
ll_to_earth(0,0.0001);
ll_to_earth(0,0.0001);
?column?
?column?
----------
----------
...
@@ -783,7 +783,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -783,7 +783,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*1.00001) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*1.00001) @
>
ll_to_earth(0.0001,0.0001);
ll_to_earth(0.0001,0.0001);
?column?
?column?
----------
----------
...
@@ -791,7 +791,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -791,7 +791,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(45,45),
SELECT earth_box(ll_to_earth(45,45),
earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*1.00001) @
earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*1.00001) @
>
ll_to_earth(45.0001,45.0001);
ll_to_earth(45.0001,45.0001);
?column?
?column?
----------
----------
...
@@ -799,7 +799,7 @@ SELECT earth_box(ll_to_earth(45,45),
...
@@ -799,7 +799,7 @@ SELECT earth_box(ll_to_earth(45,45),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(90,180),
SELECT earth_box(ll_to_earth(90,180),
earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*1.00001) @
earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*1.00001) @
>
ll_to_earth(90.0001,180.0001);
ll_to_earth(90.0001,180.0001);
?column?
?column?
----------
----------
...
@@ -812,7 +812,7 @@ SELECT earth_box(ll_to_earth(90,180),
...
@@ -812,7 +812,7 @@ SELECT earth_box(ll_to_earth(90,180),
-- but further away than the distance we are testing.
-- but further away than the distance we are testing.
--
--
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*.57735) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,1))*.57735) @
>
ll_to_earth(0,1);
ll_to_earth(0,1);
?column?
?column?
----------
----------
...
@@ -820,7 +820,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -820,7 +820,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*.57735) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.1))*.57735) @
>
ll_to_earth(0,0.1);
ll_to_earth(0,0.1);
?column?
?column?
----------
----------
...
@@ -828,7 +828,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -828,7 +828,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*.57735) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.01))*.57735) @
>
ll_to_earth(0,0.01);
ll_to_earth(0,0.01);
?column?
?column?
----------
----------
...
@@ -836,7 +836,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -836,7 +836,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*.57735) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.001))*.57735) @
>
ll_to_earth(0,0.001);
ll_to_earth(0,0.001);
?column?
?column?
----------
----------
...
@@ -844,7 +844,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -844,7 +844,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*.57735) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0,0.0001))*.57735) @
>
ll_to_earth(0,0.0001);
ll_to_earth(0,0.0001);
?column?
?column?
----------
----------
...
@@ -852,7 +852,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -852,7 +852,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(0,0),
SELECT earth_box(ll_to_earth(0,0),
earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*.57735) @
earth_distance(ll_to_earth(0,0),ll_to_earth(0.0001,0.0001))*.57735) @
>
ll_to_earth(0.0001,0.0001);
ll_to_earth(0.0001,0.0001);
?column?
?column?
----------
----------
...
@@ -860,7 +860,7 @@ SELECT earth_box(ll_to_earth(0,0),
...
@@ -860,7 +860,7 @@ SELECT earth_box(ll_to_earth(0,0),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(45,45),
SELECT earth_box(ll_to_earth(45,45),
earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*.57735) @
earth_distance(ll_to_earth(45,45),ll_to_earth(45.0001,45.0001))*.57735) @
>
ll_to_earth(45.0001,45.0001);
ll_to_earth(45.0001,45.0001);
?column?
?column?
----------
----------
...
@@ -868,7 +868,7 @@ SELECT earth_box(ll_to_earth(45,45),
...
@@ -868,7 +868,7 @@ SELECT earth_box(ll_to_earth(45,45),
(1 row)
(1 row)
SELECT earth_box(ll_to_earth(90,180),
SELECT earth_box(ll_to_earth(90,180),
earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*.57735) @
earth_distance(ll_to_earth(90,180),ll_to_earth(90.0001,180.0001))*.57735) @
>
ll_to_earth(90.0001,180.0001);
ll_to_earth(90.0001,180.0001);
?column?
?column?
----------
----------
...
...
contrib/earthdistance/sql/earthdistance.sql
View file @
684ad6a9
...
@@ -224,28 +224,28 @@ SELECT cube_ll_coord(earth_box(ll_to_earth(0,0),10*earth()),1)::numeric(20,5),
...
@@ -224,28 +224,28 @@ SELECT cube_ll_coord(earth_box(ll_to_earth(0,0),10*earth()),1)::numeric(20,5),
--
--
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
1
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
1
))
*
1
.
00001
)
@
>
ll_to_earth
(
0
,
1
);
ll_to_earth
(
0
,
1
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
1
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
1
))
*
1
.
00001
)
@
>
ll_to_earth
(
0
,
0
.
1
);
ll_to_earth
(
0
,
0
.
1
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
01
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
01
))
*
1
.
00001
)
@
>
ll_to_earth
(
0
,
0
.
01
);
ll_to_earth
(
0
,
0
.
01
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
001
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
001
))
*
1
.
00001
)
@
>
ll_to_earth
(
0
,
0
.
001
);
ll_to_earth
(
0
,
0
.
001
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
0001
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
0001
))
*
1
.
00001
)
@
>
ll_to_earth
(
0
,
0
.
0001
);
ll_to_earth
(
0
,
0
.
0001
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
.
0001
,
0
.
0001
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
.
0001
,
0
.
0001
))
*
1
.
00001
)
@
>
ll_to_earth
(
0
.
0001
,
0
.
0001
);
ll_to_earth
(
0
.
0001
,
0
.
0001
);
SELECT
earth_box
(
ll_to_earth
(
45
,
45
),
SELECT
earth_box
(
ll_to_earth
(
45
,
45
),
earth_distance
(
ll_to_earth
(
45
,
45
),
ll_to_earth
(
45
.
0001
,
45
.
0001
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
45
,
45
),
ll_to_earth
(
45
.
0001
,
45
.
0001
))
*
1
.
00001
)
@
>
ll_to_earth
(
45
.
0001
,
45
.
0001
);
ll_to_earth
(
45
.
0001
,
45
.
0001
);
SELECT
earth_box
(
ll_to_earth
(
90
,
180
),
SELECT
earth_box
(
ll_to_earth
(
90
,
180
),
earth_distance
(
ll_to_earth
(
90
,
180
),
ll_to_earth
(
90
.
0001
,
180
.
0001
))
*
1
.
00001
)
@
earth_distance
(
ll_to_earth
(
90
,
180
),
ll_to_earth
(
90
.
0001
,
180
.
0001
))
*
1
.
00001
)
@
>
ll_to_earth
(
90
.
0001
,
180
.
0001
);
ll_to_earth
(
90
.
0001
,
180
.
0001
);
--
--
...
@@ -255,28 +255,28 @@ SELECT earth_box(ll_to_earth(90,180),
...
@@ -255,28 +255,28 @@ SELECT earth_box(ll_to_earth(90,180),
--
--
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
1
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
1
))
*
.
57735
)
@
>
ll_to_earth
(
0
,
1
);
ll_to_earth
(
0
,
1
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
1
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
1
))
*
.
57735
)
@
>
ll_to_earth
(
0
,
0
.
1
);
ll_to_earth
(
0
,
0
.
1
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
01
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
01
))
*
.
57735
)
@
>
ll_to_earth
(
0
,
0
.
01
);
ll_to_earth
(
0
,
0
.
01
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
001
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
001
))
*
.
57735
)
@
>
ll_to_earth
(
0
,
0
.
001
);
ll_to_earth
(
0
,
0
.
001
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
0001
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
,
0
.
0001
))
*
.
57735
)
@
>
ll_to_earth
(
0
,
0
.
0001
);
ll_to_earth
(
0
,
0
.
0001
);
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
SELECT
earth_box
(
ll_to_earth
(
0
,
0
),
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
.
0001
,
0
.
0001
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
0
,
0
),
ll_to_earth
(
0
.
0001
,
0
.
0001
))
*
.
57735
)
@
>
ll_to_earth
(
0
.
0001
,
0
.
0001
);
ll_to_earth
(
0
.
0001
,
0
.
0001
);
SELECT
earth_box
(
ll_to_earth
(
45
,
45
),
SELECT
earth_box
(
ll_to_earth
(
45
,
45
),
earth_distance
(
ll_to_earth
(
45
,
45
),
ll_to_earth
(
45
.
0001
,
45
.
0001
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
45
,
45
),
ll_to_earth
(
45
.
0001
,
45
.
0001
))
*
.
57735
)
@
>
ll_to_earth
(
45
.
0001
,
45
.
0001
);
ll_to_earth
(
45
.
0001
,
45
.
0001
);
SELECT
earth_box
(
ll_to_earth
(
90
,
180
),
SELECT
earth_box
(
ll_to_earth
(
90
,
180
),
earth_distance
(
ll_to_earth
(
90
,
180
),
ll_to_earth
(
90
.
0001
,
180
.
0001
))
*
.
57735
)
@
earth_distance
(
ll_to_earth
(
90
,
180
),
ll_to_earth
(
90
.
0001
,
180
.
0001
))
*
.
57735
)
@
>
ll_to_earth
(
90
.
0001
,
180
.
0001
);
ll_to_earth
(
90
.
0001
,
180
.
0001
);
--
--
...
...
contrib/hstore/README.hstore
View file @
684ad6a9
...
@@ -46,23 +46,29 @@ select 'a'=>'b';
...
@@ -46,23 +46,29 @@ select 'a'=>'b';
----------
----------
"a"=>"b"
"a"=>"b"
* hstore @ hstore - contains operation, check if left operand contains right.
* hstore @
>
hstore - contains operation, check if left operand contains right.
regression=# select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>c';
regression=# select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>c';
?column?
?column?
----------
----------
f
f
(1 row)
(1 row)
regression=# select 'a=>b, b=>1, c=>NULL'::hstore @ 'b=>1';
regression=# select 'a=>b, b=>1, c=>NULL'::hstore @
>
'b=>1';
?column?
?column?
----------
----------
t
t
(1 row)
(1 row)
* hstore
~
hstore - contained operation, check if left operand is contained
* hstore
<@
hstore - contained operation, check if left operand is contained
in right
in right
(Before PostgreSQL 8.2, the containment operators @> and <@ were
respectively called @ and ~. These names are still available, but are
deprecated and will eventually be retired. Notice that the old names
are reversed from the convention formerly followed by the core geometric
datatypes!)
Functions
Functions
* akeys(hstore) - returns all keys from hstore as array
* akeys(hstore) - returns all keys from hstore as array
...
@@ -129,7 +135,7 @@ regression=# select isdefined('a=>NULL','a');
...
@@ -129,7 +135,7 @@ regression=# select isdefined('a=>NULL','a');
Indices
Indices
Module provides index support for '@
' and '~
' operations.
Module provides index support for '@
>' and '<@
' operations.
create index hidx on testhstore using gist(h);
create index hidx on testhstore using gist(h);
...
...
contrib/hstore/expected/hstore.out
View file @
684ad6a9
--
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of hstore.sql.
--
SET client_min_messages = warning;
\set ECHO none
\set ECHO none
psql:hstore.sql:8: NOTICE: type "hstore" is not yet defined
RESET client_min_messages;
DETAIL: Creating a shell type definition.
set escape_string_warning=off;
psql:hstore.sql:13: NOTICE: argument type hstore is only a shell
psql:hstore.sql:132: NOTICE: type "ghstore" is not yet defined
DETAIL: Creating a shell type definition.
psql:hstore.sql:137: NOTICE: argument type ghstore is only a shell
--hstore;
--hstore;
select ''::hstore;
select ''::hstore;
hstore
hstore
...
@@ -483,50 +484,50 @@ select * from each('aaa=>bq, b=>NULL, ""=>1 ');
...
@@ -483,50 +484,50 @@ select * from each('aaa=>bq, b=>NULL, ""=>1 ');
aaa | bq
aaa | bq
(3 rows)
(3 rows)
-- @
-- @
>
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>NULL';
?column?
?column?
----------
----------
t
t
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL, c=>NULL';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>NULL, c=>NULL';
?column?
?column?
----------
----------
t
t
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>NULL, g=>NULL';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>NULL, g=>NULL';
?column?
?column?
----------
----------
f
f
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'g=>NULL';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'g=>NULL';
?column?
?column?
----------
----------
f
f
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>c';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>c';
?column?
?column?
----------
----------
f
f
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>b';
?column?
?column?
----------
----------
t
t
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>NULL';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>b, c=>NULL';
?column?
?column?
----------
----------
t
t
(1 row)
(1 row)
select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>q';
select 'a=>b, b=>1, c=>NULL'::hstore @
>
'a=>b, c=>q';
?column?
?column?
----------
----------
f
f
...
@@ -534,19 +535,19 @@ select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>q';
...
@@ -534,19 +535,19 @@ select 'a=>b, b=>1, c=>NULL'::hstore @ 'a=>b, c=>q';
CREATE TABLE testhstore (h hstore);
CREATE TABLE testhstore (h hstore);
\copy testhstore from 'data/hstore.data'
\copy testhstore from 'data/hstore.data'
select count(*) from testhstore where h @ 'wait=>NULL';
select count(*) from testhstore where h @
>
'wait=>NULL';
count
count
-------
-------
189
189
(1 row)
(1 row)
select count(*) from testhstore where h @ 'wait=>CC';
select count(*) from testhstore where h @
>
'wait=>CC';
count
count
-------
-------
15
15
(1 row)
(1 row)
select count(*) from testhstore where h @ 'wait=>CC, public=>t';
select count(*) from testhstore where h @
>
'wait=>CC, public=>t';
count
count
-------
-------
2
2
...
@@ -554,19 +555,19 @@ select count(*) from testhstore where h @ 'wait=>CC, public=>t';
...
@@ -554,19 +555,19 @@ select count(*) from testhstore where h @ 'wait=>CC, public=>t';
create index hidx on testhstore using gist(h);
create index hidx on testhstore using gist(h);
set enable_seqscan=off;
set enable_seqscan=off;
select count(*) from testhstore where h @ 'wait=>NULL';
select count(*) from testhstore where h @
>
'wait=>NULL';
count
count
-------
-------
189
189
(1 row)
(1 row)
select count(*) from testhstore where h @ 'wait=>CC';
select count(*) from testhstore where h @
>
'wait=>CC';
count
count
-------
-------
15
15
(1 row)
(1 row)
select count(*) from testhstore where h @ 'wait=>CC, public=>t';
select count(*) from testhstore where h @
>
'wait=>CC, public=>t';
count
count
-------
-------
2
2
...
...
contrib/hstore/hstore.sql.in
View file @
684ad6a9
...
@@ -61,6 +61,30 @@ RETURNS bool
...
@@ -61,6 +61,30 @@ RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE 'C' with (isstrict,iscachable);
LANGUAGE 'C' with (isstrict,iscachable);
CREATE FUNCTION hs_contained(hstore,hstore)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE 'C' with (isstrict,iscachable);
CREATE OPERATOR @> (
LEFTARG = hstore,
RIGHTARG = hstore,
PROCEDURE = hs_contains,
COMMUTATOR = '<@',
RESTRICT = contsel,
JOIN = contjoinsel
);
CREATE OPERATOR <@ (
LEFTARG = hstore,
RIGHTARG = hstore,
PROCEDURE = hs_contained,
COMMUTATOR = '@>',
RESTRICT = contsel,
JOIN = contjoinsel
);
-- obsolete:
CREATE OPERATOR @ (
CREATE OPERATOR @ (
LEFTARG = hstore,
LEFTARG = hstore,
RIGHTARG = hstore,
RIGHTARG = hstore,
...
@@ -70,11 +94,6 @@ CREATE OPERATOR @ (
...
@@ -70,11 +94,6 @@ CREATE OPERATOR @ (
JOIN = contjoinsel
JOIN = contjoinsel
);
);
CREATE FUNCTION hs_contained(hstore,hstore)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE 'C' with (isstrict,iscachable);
CREATE OPERATOR ~ (
CREATE OPERATOR ~ (
LEFTARG = hstore,
LEFTARG = hstore,
RIGHTARG = hstore,
RIGHTARG = hstore,
...
@@ -181,8 +200,10 @@ LANGUAGE 'C';
...
@@ -181,8 +200,10 @@ LANGUAGE 'C';
CREATE OPERATOR CLASS gist_hstore_ops
CREATE OPERATOR CLASS gist_hstore_ops
DEFAULT FOR TYPE hstore USING gist
DEFAULT FOR TYPE hstore USING gist
AS
AS
OPERATOR 7 @ RECHECK,
OPERATOR 7 @> RECHECK,
--OPERATOR 8 ~ RECHECK,
--OPERATOR 8 <@ RECHECK,
OPERATOR 13 @ RECHECK,
--OPERATOR 14 ~ RECHECK,
FUNCTION 1 ghstore_consistent (internal, internal, int4),
FUNCTION 1 ghstore_consistent (internal, internal, int4),
FUNCTION 2 ghstore_union (internal, internal),
FUNCTION 2 ghstore_union (internal, internal),
FUNCTION 3 ghstore_compress (internal),
FUNCTION 3 ghstore_compress (internal),
...
...
contrib/hstore/sql/hstore.sql
View file @
684ad6a9
--
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of hstore.sql.
--
SET
client_min_messages
=
warning
;
\
set
ECHO
none
\
set
ECHO
none
\
i
hstore
.
sql
\
i
hstore
.
sql
set
escape_string_warning
=
off
;
\
set
ECHO
all
\
set
ECHO
all
RESET
client_min_messages
;
set
escape_string_warning
=
off
;
--hstore;
--hstore;
select
''
::
hstore
;
select
''
::
hstore
;
...
@@ -103,29 +111,29 @@ select * from svals('');
...
@@ -103,29 +111,29 @@ select * from svals('');
select
*
from
each
(
'aaa=>bq, b=>NULL, ""=>1 '
);
select
*
from
each
(
'aaa=>bq, b=>NULL, ""=>1 '
);
-- @
-- @
>
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>NULL, c=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>NULL, c=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>NULL, g=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>NULL, g=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'g=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'g=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>c'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>c'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>b'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>b'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>b, c=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>b, c=>NULL'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
'a=>b, c=>q'
;
select
'a=>b, b=>1, c=>NULL'
::
hstore
@
>
'a=>b, c=>q'
;
CREATE
TABLE
testhstore
(
h
hstore
);
CREATE
TABLE
testhstore
(
h
hstore
);
\
copy
testhstore
from
'data/hstore.data'
\
copy
testhstore
from
'data/hstore.data'
select
count
(
*
)
from
testhstore
where
h
@
'wait=>NULL'
;
select
count
(
*
)
from
testhstore
where
h
@
>
'wait=>NULL'
;
select
count
(
*
)
from
testhstore
where
h
@
'wait=>CC'
;
select
count
(
*
)
from
testhstore
where
h
@
>
'wait=>CC'
;
select
count
(
*
)
from
testhstore
where
h
@
'wait=>CC, public=>t'
;
select
count
(
*
)
from
testhstore
where
h
@
>
'wait=>CC, public=>t'
;
create
index
hidx
on
testhstore
using
gist
(
h
);
create
index
hidx
on
testhstore
using
gist
(
h
);
set
enable_seqscan
=
off
;
set
enable_seqscan
=
off
;
select
count
(
*
)
from
testhstore
where
h
@
'wait=>NULL'
;
select
count
(
*
)
from
testhstore
where
h
@
>
'wait=>NULL'
;
select
count
(
*
)
from
testhstore
where
h
@
'wait=>CC'
;
select
count
(
*
)
from
testhstore
where
h
@
>
'wait=>CC'
;
select
count
(
*
)
from
testhstore
where
h
@
'wait=>CC, public=>t'
;
select
count
(
*
)
from
testhstore
where
h
@
>
'wait=>CC, public=>t'
;
select
count
(
*
)
from
(
select
(
each
(
h
)).
key
from
testhstore
)
as
wow
;
select
count
(
*
)
from
(
select
(
each
(
h
)).
key
from
testhstore
)
as
wow
;
select
key
,
count
(
*
)
from
(
select
(
each
(
h
)).
key
from
testhstore
)
as
wow
group
by
key
order
by
count
desc
,
key
;
select
key
,
count
(
*
)
from
(
select
(
each
(
h
)).
key
from
testhstore
)
as
wow
group
by
key
order
by
count
desc
,
key
;
contrib/intarray/README.intarray
View file @
684ad6a9
...
@@ -70,10 +70,10 @@ test=# select intset(1);
...
@@ -70,10 +70,10 @@ test=# select intset(1);
OPERATIONS:
OPERATIONS:
int[] && int[] - overlap - returns TRUE if arrays ha
s at least one common elements.
int[] && int[] - overlap - returns TRUE if arrays ha
ve at least one common element
int[] @
int[] - contains - returns TRUE if left array contains right array
int[] @
>
int[] - contains - returns TRUE if left array contains right array
int[]
~ int[]
- contained - returns TRUE if left array is contained in right array
int[]
<@ int[]
- contained - returns TRUE if left array is contained in right array
# int[] - return the number of elements in array
# int[] - return
s
the number of elements in array
int[] + int - push element to array ( add to end of array)
int[] + int - push element to array ( add to end of array)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] + int[] - merge of arrays (right array added to the end of left one)
int[] - int - remove entries matched by right argument from array
int[] - int - remove entries matched by right argument from array
...
@@ -81,8 +81,14 @@ OPERATIONS:
...
@@ -81,8 +81,14 @@ OPERATIONS:
int[] | int - returns intarray - union of arguments
int[] | int - returns intarray - union of arguments
int[] | int[] - returns intarray as a union of two arrays
int[] | int[] - returns intarray as a union of two arrays
int[] & int[] - returns intersection of arrays
int[] & int[] - returns intersection of arrays
int[] @@ query_int - returns TRUE if array satisfies query (like '1&(2|3)')
int[] @@ query_int - returns TRUE if array satisfies query (like '1&(2|3)')
query_int ~~ int[] - -/-
query_int ~~ int[] - returns TRUE if array satisfies query (commutator of @@)
(Before PostgreSQL 8.2, the containment operators @> and <@ were
respectively called @ and ~. These names are still available, but are
deprecated and will eventually be retired. Notice that the old names
are reversed from the convention formerly followed by the core geometric
datatypes!)
CHANGES:
CHANGES:
...
@@ -128,9 +134,9 @@ CREATE INDEX message_rdtree_idx on message using gist ( sections gist__int_ops);
...
@@ -128,9 +134,9 @@ CREATE INDEX message_rdtree_idx on message using gist ( sections gist__int_ops);
select message.mid from message where message.sections && '{1,2}';
select message.mid from message where message.sections && '{1,2}';
-- select messages contains in sections 1 AND 2 - CONTAINS operator
-- select messages contains in sections 1 AND 2 - CONTAINS operator
select message.mid from message where message.sections @ '{1,2}';
select message.mid from message where message.sections @
>
'{1,2}';
-- the same, CONTAINED operator
-- the same, CONTAINED operator
select message.mid from message where '{1,2}'
~
message.sections;
select message.mid from message where '{1,2}'
<@
message.sections;
BENCHMARK:
BENCHMARK:
...
...
contrib/intarray/_int.sql.in
View file @
684ad6a9
...
@@ -12,12 +12,12 @@ BEGIN;
...
@@ -12,12 +12,12 @@ BEGIN;
CREATE FUNCTION bqarr_in(cstring)
CREATE FUNCTION bqarr_in(cstring)
RETURNS query_int
RETURNS query_int
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
CREATE FUNCTION bqarr_out(query_int)
CREATE FUNCTION bqarr_out(query_int)
RETURNS cstring
RETURNS cstring
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
CREATE TYPE query_int (
CREATE TYPE query_int (
INTERNALLENGTH = -1,
INTERNALLENGTH = -1,
...
@@ -29,20 +29,20 @@ CREATE TYPE query_int (
...
@@ -29,20 +29,20 @@ CREATE TYPE query_int (
CREATE FUNCTION querytree(query_int)
CREATE FUNCTION querytree(query_int)
RETURNS text
RETURNS text
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
CREATE FUNCTION boolop(_int4, query_int)
CREATE FUNCTION boolop(_int4, query_int)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array';
COMMENT ON FUNCTION boolop(_int4, query_int) IS 'boolean operation with array';
CREATE FUNCTION rboolop(query_int, _int4)
CREATE FUNCTION rboolop(query_int, _int4)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array';
COMMENT ON FUNCTION rboolop(query_int, _int4) IS 'boolean operation with array';
...
@@ -74,35 +74,35 @@ CREATE OPERATOR ~~ (
...
@@ -74,35 +74,35 @@ CREATE OPERATOR ~~ (
CREATE FUNCTION _int_contains(_int4, _int4)
CREATE FUNCTION _int_contains(_int4, _int4)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains';
COMMENT ON FUNCTION _int_contains(_int4, _int4) IS 'contains';
CREATE FUNCTION _int_contained(_int4, _int4)
CREATE FUNCTION _int_contained(_int4, _int4)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in';
COMMENT ON FUNCTION _int_contained(_int4, _int4) IS 'contained in';
CREATE FUNCTION _int_overlap(_int4, _int4)
CREATE FUNCTION _int_overlap(_int4, _int4)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps';
COMMENT ON FUNCTION _int_overlap(_int4, _int4) IS 'overlaps';
CREATE FUNCTION _int_same(_int4, _int4)
CREATE FUNCTION _int_same(_int4, _int4)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as';
COMMENT ON FUNCTION _int_same(_int4, _int4) IS 'same as';
CREATE FUNCTION _int_different(_int4, _int4)
CREATE FUNCTION _int_different(_int4, _int4)
RETURNS bool
RETURNS bool
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
...
@@ -111,12 +111,12 @@ COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
...
@@ -111,12 +111,12 @@ COMMENT ON FUNCTION _int_different(_int4, _int4) IS 'different';
CREATE FUNCTION _int_union(_int4, _int4)
CREATE FUNCTION _int_union(_int4, _int4)
RETURNS _int4
RETURNS _int4
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
CREATE FUNCTION _int_inter(_int4, _int4)
CREATE FUNCTION _int_inter(_int4, _int4)
RETURNS _int4
RETURNS _int4
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
--
--
-- OPERATORS
-- OPERATORS
...
@@ -153,6 +153,25 @@ CREATE OPERATOR && (
...
@@ -153,6 +153,25 @@ CREATE OPERATOR && (
-- JOIN = neqjoinsel
-- JOIN = neqjoinsel
--);
--);
CREATE OPERATOR @> (
LEFTARG = _int4,
RIGHTARG = _int4,
PROCEDURE = _int_contains,
COMMUTATOR = '<@',
RESTRICT = contsel,
JOIN = contjoinsel
);
CREATE OPERATOR <@ (
LEFTARG = _int4,
RIGHTARG = _int4,
PROCEDURE = _int_contained,
COMMUTATOR = '@>',
RESTRICT = contsel,
JOIN = contjoinsel
);
-- obsolete:
CREATE OPERATOR @ (
CREATE OPERATOR @ (
LEFTARG = _int4,
LEFTARG = _int4,
RIGHTARG = _int4,
RIGHTARG = _int4,
...
@@ -347,8 +366,10 @@ CREATE OPERATOR CLASS gist__int_ops
...
@@ -347,8 +366,10 @@ CREATE OPERATOR CLASS gist__int_ops
DEFAULT FOR TYPE _int4 USING gist AS
DEFAULT FOR TYPE _int4 USING gist AS
OPERATOR 3 &&,
OPERATOR 3 &&,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
OPERATOR 7 @,
OPERATOR 7 @>,
OPERATOR 8 ~,
OPERATOR 8 <@,
OPERATOR 13 @,
OPERATOR 14 ~,
OPERATOR 20 @@ (_int4, query_int),
OPERATOR 20 @@ (_int4, query_int),
FUNCTION 1 g_int_consistent (internal, _int4, int4),
FUNCTION 1 g_int_consistent (internal, _int4, int4),
FUNCTION 2 g_int_union (internal, internal),
FUNCTION 2 g_int_union (internal, internal),
...
@@ -367,12 +388,12 @@ DEFAULT FOR TYPE _int4 USING gist AS
...
@@ -367,12 +388,12 @@ DEFAULT FOR TYPE _int4 USING gist AS
CREATE FUNCTION _intbig_in(cstring)
CREATE FUNCTION _intbig_in(cstring)
RETURNS intbig_gkey
RETURNS intbig_gkey
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
CREATE FUNCTION _intbig_out(intbig_gkey)
CREATE FUNCTION _intbig_out(intbig_gkey)
RETURNS cstring
RETURNS cstring
AS 'MODULE_PATHNAME'
AS 'MODULE_PATHNAME'
LANGUAGE C RETURNS NULL ON NULL INPUT;
LANGUAGE C RETURNS NULL ON NULL INPUT
IMMUTABLE
;
CREATE TYPE intbig_gkey (
CREATE TYPE intbig_gkey (
INTERNALLENGTH = -1,
INTERNALLENGTH = -1,
...
@@ -422,8 +443,10 @@ FOR TYPE _int4 USING gist
...
@@ -422,8 +443,10 @@ FOR TYPE _int4 USING gist
AS
AS
OPERATOR 3 && RECHECK,
OPERATOR 3 && RECHECK,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
OPERATOR 7 @ RECHECK,
OPERATOR 7 @> RECHECK,
OPERATOR 8 ~ RECHECK,
OPERATOR 8 <@ RECHECK,
OPERATOR 13 @ RECHECK,
OPERATOR 14 ~ RECHECK,
OPERATOR 20 @@ (_int4, query_int) RECHECK,
OPERATOR 20 @@ (_int4, query_int) RECHECK,
FUNCTION 1 g_intbig_consistent (internal, internal, int4),
FUNCTION 1 g_intbig_consistent (internal, internal, int4),
FUNCTION 2 g_intbig_union (internal, internal),
FUNCTION 2 g_intbig_union (internal, internal),
...
@@ -455,8 +478,10 @@ DEFAULT FOR TYPE _int4 USING gin
...
@@ -455,8 +478,10 @@ DEFAULT FOR TYPE _int4 USING gin
AS
AS
OPERATOR 3 &&,
OPERATOR 3 &&,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
OPERATOR 6 = (anyarray, anyarray) RECHECK,
OPERATOR 7 @,
OPERATOR 7 @>,
OPERATOR 8 ~ RECHECK,
OPERATOR 8 <@ RECHECK,
OPERATOR 13 @,
OPERATOR 14 ~ RECHECK,
OPERATOR 20 @@ (_int4, query_int),
OPERATOR 20 @@ (_int4, query_int),
FUNCTION 1 btint4cmp (int4, int4),
FUNCTION 1 btint4cmp (int4, int4),
FUNCTION 2 ginarrayextract (anyarray, internal),
FUNCTION 2 ginarrayextract (anyarray, internal),
...
...
contrib/intarray/_int_gin.c
View file @
684ad6a9
...
@@ -68,12 +68,14 @@ ginint4_consistent(PG_FUNCTION_ARGS) {
...
@@ -68,12 +68,14 @@ ginint4_consistent(PG_FUNCTION_ARGS) {
switch
(
strategy
)
{
switch
(
strategy
)
{
case
RTOverlapStrategyNumber
:
case
RTOverlapStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
/* at least one element in check[] is true, so result = true */
/* at least one element in check[] is true, so result = true */
res
=
TRUE
;
res
=
TRUE
;
break
;
break
;
case
RTSameStrategyNumber
:
case
RTSameStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
res
=
TRUE
;
res
=
TRUE
;
do
{
do
{
ArrayType
*
query
=
PG_GETARG_ARRAYTYPE_P
(
2
);
ArrayType
*
query
=
PG_GETARG_ARRAYTYPE_P
(
2
);
...
...
contrib/intarray/_int_gist.c
View file @
684ad6a9
...
@@ -72,10 +72,12 @@ g_int_consistent(PG_FUNCTION_ARGS)
...
@@ -72,10 +72,12 @@ g_int_consistent(PG_FUNCTION_ARGS)
query
);
query
);
break
;
break
;
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
retval
=
inner_int_contains
((
ArrayType
*
)
DatumGetPointer
(
entry
->
key
),
retval
=
inner_int_contains
((
ArrayType
*
)
DatumGetPointer
(
entry
->
key
),
query
);
query
);
break
;
break
;
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
if
(
GIST_LEAF
(
entry
))
if
(
GIST_LEAF
(
entry
))
retval
=
inner_int_contains
(
query
,
retval
=
inner_int_contains
(
query
,
(
ArrayType
*
)
DatumGetPointer
(
entry
->
key
));
(
ArrayType
*
)
DatumGetPointer
(
entry
->
key
));
...
...
contrib/intarray/_intbig_gist.c
View file @
684ad6a9
...
@@ -560,9 +560,11 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
...
@@ -560,9 +560,11 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
retval
=
_intbig_contains
((
GISTTYPE
*
)
DatumGetPointer
(
entry
->
key
),
query
);
retval
=
_intbig_contains
((
GISTTYPE
*
)
DatumGetPointer
(
entry
->
key
),
query
);
break
;
break
;
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
retval
=
_intbig_contains
((
GISTTYPE
*
)
DatumGetPointer
(
entry
->
key
),
query
);
retval
=
_intbig_contains
((
GISTTYPE
*
)
DatumGetPointer
(
entry
->
key
),
query
);
break
;
break
;
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
if
(
GIST_LEAF
(
entry
))
if
(
GIST_LEAF
(
entry
))
{
{
int
i
,
int
i
,
...
...
contrib/intarray/expected/_int.out
View file @
684ad6a9
...
@@ -2,13 +2,9 @@
...
@@ -2,13 +2,9 @@
-- first, define the datatype. Turn off echoing so that expected file
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of _int.sql.
-- does not depend on contents of _int.sql.
--
--
SET client_min_messages = warning;
\set ECHO none
\set ECHO none
psql:_int.sql:15: NOTICE: type "query_int" is not yet defined
RESET client_min_messages;
DETAIL: Creating a shell type definition.
psql:_int.sql:20: NOTICE: argument type query_int is only a shell
psql:_int.sql:370: NOTICE: type "intbig_gkey" is not yet defined
DETAIL: Creating a shell type definition.
psql:_int.sql:375: NOTICE: argument type intbig_gkey is only a shell
SELECT intset(1234);
SELECT intset(1234);
intset
intset
--------
--------
...
@@ -384,7 +380,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
...
@@ -384,7 +380,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
403
403
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{23,50}';
SELECT count(*) from test__int WHERE a @
>
'{23,50}';
count
count
-------
-------
12
12
...
@@ -396,7 +392,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
...
@@ -396,7 +392,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
12
12
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{20,23}';
SELECT count(*) from test__int WHERE a @
>
'{20,23}';
count
count
-------
-------
12
12
...
@@ -408,7 +404,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
...
@@ -408,7 +404,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
9
9
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @
'{20,23}' or a @
'{50,68}';
SELECT count(*) from test__int WHERE a @
> '{20,23}' or a @>
'{50,68}';
count
count
-------
-------
21
21
...
@@ -433,7 +429,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
...
@@ -433,7 +429,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
403
403
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{23,50}';
SELECT count(*) from test__int WHERE a @
>
'{23,50}';
count
count
-------
-------
12
12
...
@@ -445,7 +441,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
...
@@ -445,7 +441,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
12
12
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{20,23}';
SELECT count(*) from test__int WHERE a @
>
'{20,23}';
count
count
-------
-------
12
12
...
@@ -457,7 +453,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
...
@@ -457,7 +453,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
9
9
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @
'{20,23}' or a @
'{50,68}';
SELECT count(*) from test__int WHERE a @
> '{20,23}' or a @>
'{50,68}';
count
count
-------
-------
21
21
...
@@ -483,7 +479,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
...
@@ -483,7 +479,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
403
403
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{23,50}';
SELECT count(*) from test__int WHERE a @
>
'{23,50}';
count
count
-------
-------
12
12
...
@@ -495,7 +491,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
...
@@ -495,7 +491,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
12
12
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{20,23}';
SELECT count(*) from test__int WHERE a @
>
'{20,23}';
count
count
-------
-------
12
12
...
@@ -507,7 +503,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
...
@@ -507,7 +503,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
9
9
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @
'{20,23}' or a @
'{50,68}';
SELECT count(*) from test__int WHERE a @
> '{20,23}' or a @>
'{50,68}';
count
count
-------
-------
21
21
...
@@ -533,7 +529,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
...
@@ -533,7 +529,7 @@ SELECT count(*) from test__int WHERE a @@ '23|50';
403
403
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{23,50}';
SELECT count(*) from test__int WHERE a @
>
'{23,50}';
count
count
-------
-------
12
12
...
@@ -545,7 +541,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
...
@@ -545,7 +541,7 @@ SELECT count(*) from test__int WHERE a @@ '23&50';
12
12
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @ '{20,23}';
SELECT count(*) from test__int WHERE a @
>
'{20,23}';
count
count
-------
-------
12
12
...
@@ -557,7 +553,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
...
@@ -557,7 +553,7 @@ SELECT count(*) from test__int WHERE a @@ '50&68';
9
9
(1 row)
(1 row)
SELECT count(*) from test__int WHERE a @
'{20,23}' or a @
'{50,68}';
SELECT count(*) from test__int WHERE a @
> '{20,23}' or a @>
'{50,68}';
count
count
-------
-------
21
21
...
...
contrib/intarray/sql/_int.sql
View file @
684ad6a9
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
-- first, define the datatype. Turn off echoing so that expected file
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of _int.sql.
-- does not depend on contents of _int.sql.
--
--
SET
client_min_messages
=
warning
;
\
set
ECHO
none
\
set
ECHO
none
\
i
_int
.
sql
\
i
_int
.
sql
\
set
ECHO
all
\
set
ECHO
all
RESET
client_min_messages
;
SELECT
intset
(
1234
);
SELECT
intset
(
1234
);
SELECT
icount
(
'{1234234,234234}'
);
SELECT
icount
(
'{1234234,234234}'
);
...
@@ -78,22 +80,22 @@ CREATE TABLE test__int( a int[] );
...
@@ -78,22 +80,22 @@ CREATE TABLE test__int( a int[] );
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
or
a
@
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
or
a
@>
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
CREATE
INDEX
text_idx
on
test__int
using
gist
(
a
gist__int_ops
);
CREATE
INDEX
text_idx
on
test__int
using
gist
(
a
gist__int_ops
);
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
or
a
@
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
or
a
@>
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
DROP
INDEX
text_idx
;
DROP
INDEX
text_idx
;
...
@@ -101,11 +103,11 @@ CREATE INDEX text_idx on test__int using gist ( a gist__intbig_ops );
...
@@ -101,11 +103,11 @@ CREATE INDEX text_idx on test__int using gist ( a gist__intbig_ops );
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
or
a
@
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
or
a
@>
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
DROP
INDEX
text_idx
;
DROP
INDEX
text_idx
;
...
@@ -113,9 +115,9 @@ CREATE INDEX text_idx on test__int using gin ( a );
...
@@ -113,9 +115,9 @@ CREATE INDEX text_idx on test__int using gin ( a );
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23|50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'23&50'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'50&68'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{20,23}'
or
a
@
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
>
'{20,23}'
or
a
@>
'{50,68}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@@
'(20&23)|(50&68)'
;
contrib/intarray/uninstall__int.sql
View file @
684ad6a9
SET
search_path
=
public
;
SET
search_path
=
public
;
DROP
OPERATOR
CLASS
gin__int_ops
USING
gin
;
DROP
FUNCTION
ginint4_queryextract
(
internal
,
internal
,
int2
);
DROP
FUNCTION
ginint4_consistent
(
internal
,
int2
,
internal
);
DROP
OPERATOR
CLASS
gist__intbig_ops
USING
gist
;
DROP
OPERATOR
CLASS
gist__intbig_ops
USING
gist
;
DROP
FUNCTION
g_intbig_same
(
internal
,
internal
,
internal
);
DROP
FUNCTION
g_intbig_same
(
internal
,
internal
,
internal
);
...
@@ -82,6 +88,10 @@ DROP FUNCTION icount(_int4);
...
@@ -82,6 +88,10 @@ DROP FUNCTION icount(_int4);
DROP
FUNCTION
intset
(
int4
);
DROP
FUNCTION
intset
(
int4
);
DROP
OPERATOR
<@
(
_int4
,
_int4
);
DROP
OPERATOR
@>
(
_int4
,
_int4
);
DROP
OPERATOR
~
(
_int4
,
_int4
);
DROP
OPERATOR
~
(
_int4
,
_int4
);
DROP
OPERATOR
@
(
_int4
,
_int4
);
DROP
OPERATOR
@
(
_int4
,
_int4
);
...
...
contrib/seg/README.seg
View file @
684ad6a9
...
@@ -257,16 +257,22 @@ The operators supported by the GiST access method include:
...
@@ -257,16 +257,22 @@ The operators supported by the GiST access method include:
The segments [a, b] and [c, d] overlap.
The segments [a, b] and [c, d] overlap.
[a, b] @ [c, d] Contains
[a, b] @
>
[c, d] Contains
The segment [a, b] contains the segment [c, d], that is,
The segment [a, b] contains the segment [c, d], that is,
a <= c and b >= d
a <= c and b >= d
[a, b] @ [c, d] Contained in
[a, b]
<
@ [c, d] Contained in
The segment [a, b] is contained in [c, d], that is,
The segment [a, b] is contained in [c, d], that is,
a >= c and b <= d
a >= c and b <= d
(Before PostgreSQL 8.2, the containment operators @> and <@ were
respectively called @ and ~. These names are still available, but are
deprecated and will eventually be retired. Notice that the old names
are reversed from the convention formerly followed by the core geometric
datatypes!)
Although the mnemonics of the following operators is questionable, I
Although the mnemonics of the following operators is questionable, I
preserved them to maintain visual consistency with other geometric
preserved them to maintain visual consistency with other geometric
data types defined in Postgres.
data types defined in Postgres.
...
...
contrib/seg/expected/seg.out
View file @
684ad6a9
...
@@ -5,10 +5,9 @@
...
@@ -5,10 +5,9 @@
-- first, define the datatype. Turn off echoing so that expected file
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of seg.sql.
-- does not depend on contents of seg.sql.
--
--
SET client_min_messages = warning;
\set ECHO none
\set ECHO none
psql:seg.sql:10: NOTICE: type "seg" is not yet defined
RESET client_min_messages;
DETAIL: Creating a shell type definition.
psql:seg.sql:15: NOTICE: argument type seg is only a shell
--
--
-- testing the input and output functions
-- testing the input and output functions
--
--
...
@@ -814,49 +813,49 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
...
@@ -814,49 +813,49 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
-- "contained in" (the left value belongs within the interval specified in the right value):
-- "contained in" (the left value belongs within the interval specified in the right value):
--
--
SELECT '0'::seg
~
'0'::seg AS bool;
SELECT '0'::seg
<@
'0'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'0 ..'::seg AS bool;
SELECT '0'::seg
<@
'0 ..'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'.. 0'::seg AS bool;
SELECT '0'::seg
<@
'.. 0'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '0'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '0'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '-1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1 .. 1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '-1 .. 1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
...
@@ -864,43 +863,43 @@ SELECT '-1 .. 1'::seg ~ '-1 .. 1'::seg AS bool;
...
@@ -864,43 +863,43 @@ SELECT '-1 .. 1'::seg ~ '-1 .. 1'::seg AS bool;
-- "contains" (the left value contains the interval specified in the right value):
-- "contains" (the left value contains the interval specified in the right value):
--
--
SELECT '0'::seg @ '0'::seg AS bool;
SELECT '0'::seg @
>
'0'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0 .. '::seg
~
'0'::seg AS bool;
SELECT '0 .. '::seg
<@
'0'::seg AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '.. 0'::seg
~
'0'::seg AS bool;
SELECT '.. 0'::seg
<@
'0'::seg AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '-1 .. 1'::seg
~
'0'::seg AS bool;
SELECT '-1 .. 1'::seg
<@
'0'::seg AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '0'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '0'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '-1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
...
@@ -911,14 +910,14 @@ SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
...
@@ -911,14 +910,14 @@ SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
CREATE TABLE test_seg (s seg);
CREATE TABLE test_seg (s seg);
\copy test_seg from 'data/test_seg.data'
\copy test_seg from 'data/test_seg.data'
CREATE INDEX test_seg_ix ON test_seg USING gist (s);
CREATE INDEX test_seg_ix ON test_seg USING gist (s);
SELECT count(*) FROM test_seg WHERE s @ '11..11.3';
SELECT count(*) FROM test_seg WHERE s @
>
'11..11.3';
count
count
-------
-------
143
143
(1 row)
(1 row)
-- Test sorting
-- Test sorting
SELECT * FROM test_seg WHERE s @ '11..11.3' GROUP BY s;
SELECT * FROM test_seg WHERE s @
>
'11..11.3' GROUP BY s;
s
s
-----------------
-----------------
.. 4.0e1
.. 4.0e1
...
...
contrib/seg/expected/seg_1.out
View file @
684ad6a9
...
@@ -5,10 +5,9 @@
...
@@ -5,10 +5,9 @@
-- first, define the datatype. Turn off echoing so that expected file
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of seg.sql.
-- does not depend on contents of seg.sql.
--
--
SET client_min_messages = warning;
\set ECHO none
\set ECHO none
psql:seg.sql:10: NOTICE: type "seg" is not yet defined
RESET client_min_messages;
DETAIL: Creating a shell type definition.
psql:seg.sql:15: NOTICE: argument type seg is only a shell
--
--
-- testing the input and output functions
-- testing the input and output functions
--
--
...
@@ -814,49 +813,49 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
...
@@ -814,49 +813,49 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
-- "contained in" (the left value belongs within the interval specified in the right value):
-- "contained in" (the left value belongs within the interval specified in the right value):
--
--
SELECT '0'::seg
~
'0'::seg AS bool;
SELECT '0'::seg
<@
'0'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'0 ..'::seg AS bool;
SELECT '0'::seg
<@
'0 ..'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'.. 0'::seg AS bool;
SELECT '0'::seg
<@
'.. 0'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '0'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '0'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '-1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1 .. 1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '-1 .. 1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
...
@@ -864,43 +863,43 @@ SELECT '-1 .. 1'::seg ~ '-1 .. 1'::seg AS bool;
...
@@ -864,43 +863,43 @@ SELECT '-1 .. 1'::seg ~ '-1 .. 1'::seg AS bool;
-- "contains" (the left value contains the interval specified in the right value):
-- "contains" (the left value contains the interval specified in the right value):
--
--
SELECT '0'::seg @ '0'::seg AS bool;
SELECT '0'::seg @
>
'0'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '0 .. '::seg
~
'0'::seg AS bool;
SELECT '0 .. '::seg
<@
'0'::seg AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '.. 0'::seg
~
'0'::seg AS bool;
SELECT '.. 0'::seg
<@
'0'::seg AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '-1 .. 1'::seg
~
'0'::seg AS bool;
SELECT '-1 .. 1'::seg
<@
'0'::seg AS bool;
bool
bool
------
------
f
f
(1 row)
(1 row)
SELECT '0'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '0'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '-1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '-1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
(1 row)
(1 row)
SELECT '1'::seg
~
'-1 .. 1'::seg AS bool;
SELECT '1'::seg
<@
'-1 .. 1'::seg AS bool;
bool
bool
------
------
t
t
...
@@ -911,14 +910,14 @@ SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
...
@@ -911,14 +910,14 @@ SELECT '1'::seg ~ '-1 .. 1'::seg AS bool;
CREATE TABLE test_seg (s seg);
CREATE TABLE test_seg (s seg);
\copy test_seg from 'data/test_seg.data'
\copy test_seg from 'data/test_seg.data'
CREATE INDEX test_seg_ix ON test_seg USING gist (s);
CREATE INDEX test_seg_ix ON test_seg USING gist (s);
SELECT count(*) FROM test_seg WHERE s @ '11..11.3';
SELECT count(*) FROM test_seg WHERE s @
>
'11..11.3';
count
count
-------
-------
143
143
(1 row)
(1 row)
-- Test sorting
-- Test sorting
SELECT * FROM test_seg WHERE s @ '11..11.3' GROUP BY s;
SELECT * FROM test_seg WHERE s @
>
'11..11.3' GROUP BY s;
s
s
-----------------
-----------------
.. 4.0e1
.. 4.0e1
...
...
contrib/seg/seg.c
View file @
684ad6a9
...
@@ -492,9 +492,11 @@ gseg_leaf_consistent(SEG * key,
...
@@ -492,9 +492,11 @@ gseg_leaf_consistent(SEG * key,
retval
=
(
bool
)
seg_same
(
key
,
query
);
retval
=
(
bool
)
seg_same
(
key
,
query
);
break
;
break
;
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
retval
=
(
bool
)
seg_contains
(
key
,
query
);
retval
=
(
bool
)
seg_contains
(
key
,
query
);
break
;
break
;
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
retval
=
(
bool
)
seg_contained
(
key
,
query
);
retval
=
(
bool
)
seg_contained
(
key
,
query
);
break
;
break
;
default:
default:
...
@@ -533,9 +535,11 @@ gseg_internal_consistent(SEG * key,
...
@@ -533,9 +535,11 @@ gseg_internal_consistent(SEG * key,
break
;
break
;
case
RTSameStrategyNumber
:
case
RTSameStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTContainsStrategyNumber
:
case
RTOldContainsStrategyNumber
:
retval
=
(
bool
)
seg_contains
(
key
,
query
);
retval
=
(
bool
)
seg_contains
(
key
,
query
);
break
;
break
;
case
RTContainedByStrategyNumber
:
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
retval
=
(
bool
)
seg_overlap
(
key
,
query
);
retval
=
(
bool
)
seg_overlap
(
key
,
query
);
break
;
break
;
default:
default:
...
...
contrib/seg/seg.sql.in
View file @
684ad6a9
...
@@ -281,6 +281,25 @@ CREATE OPERATOR <> (
...
@@ -281,6 +281,25 @@ CREATE OPERATOR <> (
JOIN = neqjoinsel
JOIN = neqjoinsel
);
);
CREATE OPERATOR @> (
LEFTARG = seg,
RIGHTARG = seg,
PROCEDURE = seg_contains,
COMMUTATOR = '<@',
RESTRICT = contsel,
JOIN = contjoinsel
);
CREATE OPERATOR <@ (
LEFTARG = seg,
RIGHTARG = seg,
PROCEDURE = seg_contained,
COMMUTATOR = '@>',
RESTRICT = contsel,
JOIN = contjoinsel
);
-- obsolete:
CREATE OPERATOR @ (
CREATE OPERATOR @ (
LEFTARG = seg,
LEFTARG = seg,
RIGHTARG = seg,
RIGHTARG = seg,
...
@@ -357,8 +376,10 @@ AS
...
@@ -357,8 +376,10 @@ AS
OPERATOR 4 &> ,
OPERATOR 4 &> ,
OPERATOR 5 >> ,
OPERATOR 5 >> ,
OPERATOR 6 = ,
OPERATOR 6 = ,
OPERATOR 7 @ ,
OPERATOR 7 @> ,
OPERATOR 8 ~ ,
OPERATOR 8 <@ ,
OPERATOR 13 @ ,
OPERATOR 14 ~ ,
FUNCTION 1 gseg_consistent (internal, seg, int4),
FUNCTION 1 gseg_consistent (internal, seg, int4),
FUNCTION 2 gseg_union (internal, internal),
FUNCTION 2 gseg_union (internal, internal),
FUNCTION 3 gseg_compress (internal),
FUNCTION 3 gseg_compress (internal),
...
...
contrib/seg/sql/seg.sql
View file @
684ad6a9
...
@@ -6,9 +6,11 @@
...
@@ -6,9 +6,11 @@
-- first, define the datatype. Turn off echoing so that expected file
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of seg.sql.
-- does not depend on contents of seg.sql.
--
--
SET
client_min_messages
=
warning
;
\
set
ECHO
none
\
set
ECHO
none
\
i
seg
.
sql
\
i
seg
.
sql
\
set
ECHO
all
\
set
ECHO
all
RESET
client_min_messages
;
--
--
-- testing the input and output functions
-- testing the input and output functions
...
@@ -191,24 +193,24 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
...
@@ -191,24 +193,24 @@ SELECT '2 .. 3'::seg >> '0 .. 1'::seg AS bool;
-- "contained in" (the left value belongs within the interval specified in the right value):
-- "contained in" (the left value belongs within the interval specified in the right value):
--
--
SELECT
'0'
::
seg
~
'0'
::
seg
AS
bool
;
SELECT
'0'
::
seg
<@
'0'
::
seg
AS
bool
;
SELECT
'0'
::
seg
~
'0 ..'
::
seg
AS
bool
;
SELECT
'0'
::
seg
<@
'0 ..'
::
seg
AS
bool
;
SELECT
'0'
::
seg
~
'.. 0'
::
seg
AS
bool
;
SELECT
'0'
::
seg
<@
'.. 0'
::
seg
AS
bool
;
SELECT
'0'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'0'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'0'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'0'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'-1'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'-1'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'1'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'1'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'-1 .. 1'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'-1 .. 1'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
-- "contains" (the left value contains the interval specified in the right value):
-- "contains" (the left value contains the interval specified in the right value):
--
--
SELECT
'0'
::
seg
@
'0'
::
seg
AS
bool
;
SELECT
'0'
::
seg
@
>
'0'
::
seg
AS
bool
;
SELECT
'0 .. '
::
seg
~
'0'
::
seg
AS
bool
;
SELECT
'0 .. '
::
seg
<@
'0'
::
seg
AS
bool
;
SELECT
'.. 0'
::
seg
~
'0'
::
seg
AS
bool
;
SELECT
'.. 0'
::
seg
<@
'0'
::
seg
AS
bool
;
SELECT
'-1 .. 1'
::
seg
~
'0'
::
seg
AS
bool
;
SELECT
'-1 .. 1'
::
seg
<@
'0'
::
seg
AS
bool
;
SELECT
'0'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'0'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'-1'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'-1'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'1'
::
seg
~
'-1 .. 1'
::
seg
AS
bool
;
SELECT
'1'
::
seg
<@
'-1 .. 1'
::
seg
AS
bool
;
-- Load some example data and build the index
-- Load some example data and build the index
--
--
...
@@ -217,7 +219,7 @@ CREATE TABLE test_seg (s seg);
...
@@ -217,7 +219,7 @@ CREATE TABLE test_seg (s seg);
\
copy
test_seg
from
'data/test_seg.data'
\
copy
test_seg
from
'data/test_seg.data'
CREATE
INDEX
test_seg_ix
ON
test_seg
USING
gist
(
s
);
CREATE
INDEX
test_seg_ix
ON
test_seg
USING
gist
(
s
);
SELECT
count
(
*
)
FROM
test_seg
WHERE
s
@
'11..11.3'
;
SELECT
count
(
*
)
FROM
test_seg
WHERE
s
@
>
'11..11.3'
;
-- Test sorting
-- Test sorting
SELECT
*
FROM
test_seg
WHERE
s
@
'11..11.3'
GROUP
BY
s
;
SELECT
*
FROM
test_seg
WHERE
s
@
>
'11..11.3'
GROUP
BY
s
;
contrib/seg/uninstall_seg.sql
View file @
684ad6a9
...
@@ -18,6 +18,10 @@ DROP FUNCTION gseg_compress(internal);
...
@@ -18,6 +18,10 @@ DROP FUNCTION gseg_compress(internal);
DROP
FUNCTION
gseg_consistent
(
internal
,
seg
,
int4
);
DROP
FUNCTION
gseg_consistent
(
internal
,
seg
,
int4
);
DROP
OPERATOR
<@
(
seg
,
seg
);
DROP
OPERATOR
@>
(
seg
,
seg
);
DROP
OPERATOR
~
(
seg
,
seg
);
DROP
OPERATOR
~
(
seg
,
seg
);
DROP
OPERATOR
@
(
seg
,
seg
);
DROP
OPERATOR
@
(
seg
,
seg
);
...
...
contrib/tsearch2/expected/tsearch2.out
View file @
684ad6a9
This diff is collapsed.
Click to expand it.
contrib/tsearch2/query_gist.c
View file @
684ad6a9
...
@@ -184,11 +184,28 @@ gtsq_consistent(PG_FUNCTION_ARGS)
...
@@ -184,11 +184,28 @@ gtsq_consistent(PG_FUNCTION_ARGS)
QUERYTYPE
*
query
=
(
QUERYTYPE
*
)
DatumGetPointer
(
PG_DETOAST_DATUM
(
PG_GETARG_DATUM
(
1
)));
QUERYTYPE
*
query
=
(
QUERYTYPE
*
)
DatumGetPointer
(
PG_DETOAST_DATUM
(
PG_GETARG_DATUM
(
1
)));
StrategyNumber
strategy
=
(
StrategyNumber
)
PG_GETARG_UINT16
(
2
);
StrategyNumber
strategy
=
(
StrategyNumber
)
PG_GETARG_UINT16
(
2
);
TPQTGist
sq
=
makesign
(
query
);
TPQTGist
sq
=
makesign
(
query
);
bool
retval
;
if
(
GIST_LEAF
(
entry
))
switch
(
strategy
)
PG_RETURN_BOOL
(((
*
key
)
&
sq
)
==
((
strategy
==
1
)
?
sq
:
*
key
));
{
else
case
RTContainsStrategyNumber
:
PG_RETURN_BOOL
((
*
key
)
&
sq
);
case
RTOldContainsStrategyNumber
:
if
(
GIST_LEAF
(
entry
))
retval
=
(
*
key
&
sq
)
==
sq
;
else
retval
=
(
*
key
&
sq
)
!=
0
;
break
;
case
RTContainedByStrategyNumber
:
case
RTOldContainedByStrategyNumber
:
if
(
GIST_LEAF
(
entry
))
retval
=
(
*
key
&
sq
)
==
*
key
;
else
retval
=
(
*
key
&
sq
)
!=
0
;
break
;
default:
retval
=
FALSE
;
}
PG_RETURN_BOOL
(
retval
);
}
}
Datum
Datum
...
...
contrib/tsearch2/sql/tsearch2.sql
View file @
684ad6a9
--
--
-- first, define the datatype. Turn off echoing so that expected file
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of
seg
.sql.
-- does not depend on contents of
tsearch2
.sql.
--
--
SET
client_min_messages
=
warning
;
\
set
ECHO
none
\
set
ECHO
none
\
i
tsearch2
.
sql
\
i
tsearch2
.
sql
\
set
ECHO
all
\
set
ECHO
all
RESET
client_min_messages
;
--tsvector
--tsvector
SELECT
'1'
::
tsvector
;
SELECT
'1'
::
tsvector
;
...
@@ -119,30 +121,30 @@ select rewrite( ARRAY['moscow & hotel', keyword, sample] ) from test_tsquery;
...
@@ -119,30 +121,30 @@ select rewrite( ARRAY['moscow & hotel', keyword, sample] ) from test_tsquery;
select
rewrite
(
ARRAY
[
'bar & new & qq & foo & york'
,
keyword
,
sample
]
)
from
test_tsquery
;
select
rewrite
(
ARRAY
[
'bar & new & qq & foo & york'
,
keyword
,
sample
]
)
from
test_tsquery
;
select
keyword
from
test_tsquery
where
keyword
@
'new'
;
select
keyword
from
test_tsquery
where
keyword
@
>
'new'
;
select
keyword
from
test_tsquery
where
keyword
@
'moscow'
;
select
keyword
from
test_tsquery
where
keyword
@
>
'moscow'
;
select
keyword
from
test_tsquery
where
keyword
~
'new'
;
select
keyword
from
test_tsquery
where
keyword
<@
'new'
;
select
keyword
from
test_tsquery
where
keyword
~
'moscow'
;
select
keyword
from
test_tsquery
where
keyword
<@
'moscow'
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
keyword
~
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
keyword
<@
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
keyword
~
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
keyword
<@
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
keyword
~
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
keyword
<@
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
query
@
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
query
@
>
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
query
@
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
query
@
>
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
query
@
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
query
@
>
keyword
;
create
index
qq
on
test_tsquery
using
gist
(
keyword
gist_tp_tsquery_ops
);
create
index
qq
on
test_tsquery
using
gist
(
keyword
gist_tp_tsquery_ops
);
set
enable_seqscan
=
'off'
;
set
enable_seqscan
=
'off'
;
select
keyword
from
test_tsquery
where
keyword
@
'new'
;
select
keyword
from
test_tsquery
where
keyword
@
>
'new'
;
select
keyword
from
test_tsquery
where
keyword
@
'moscow'
;
select
keyword
from
test_tsquery
where
keyword
@
>
'moscow'
;
select
keyword
from
test_tsquery
where
keyword
~
'new'
;
select
keyword
from
test_tsquery
where
keyword
<@
'new'
;
select
keyword
from
test_tsquery
where
keyword
~
'moscow'
;
select
keyword
from
test_tsquery
where
keyword
<@
'moscow'
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
keyword
~
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
keyword
<@
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
keyword
~
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
keyword
<@
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
keyword
~
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
keyword
<@
query
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
query
@
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow'
)
as
query
where
query
@
>
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
query
@
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'moscow & hotel'
)
as
query
where
query
@
>
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
query
@
keyword
;
select
rewrite
(
ARRAY
[
query
,
keyword
,
sample
]
)
from
test_tsquery
,
to_tsquery
(
'default'
,
'bar & new & qq & foo & york'
)
as
query
where
query
@
>
keyword
;
set
enable_seqscan
=
'on'
;
set
enable_seqscan
=
'on'
;
...
...
contrib/tsearch2/tsearch.sql.in
View file @
684ad6a9
...
@@ -1080,6 +1080,25 @@ CREATE OR REPLACE FUNCTION tsq_mcontained(tsquery, tsquery)
...
@@ -1080,6 +1080,25 @@ CREATE OR REPLACE FUNCTION tsq_mcontained(tsquery, tsquery)
LANGUAGE C
LANGUAGE C
RETURNS NULL ON NULL INPUT IMMUTABLE;
RETURNS NULL ON NULL INPUT IMMUTABLE;
CREATE OPERATOR @> (
LEFTARG = tsquery,
RIGHTARG = tsquery,
PROCEDURE = tsq_mcontains,
COMMUTATOR = '<@',
RESTRICT = contsel,
JOIN = contjoinsel
);
CREATE OPERATOR <@ (
LEFTARG = tsquery,
RIGHTARG = tsquery,
PROCEDURE = tsq_mcontained,
COMMUTATOR = '@>',
RESTRICT = contsel,
JOIN = contjoinsel
);
-- obsolete:
CREATE OPERATOR @ (
CREATE OPERATOR @ (
LEFTARG = tsquery,
LEFTARG = tsquery,
RIGHTARG = tsquery,
RIGHTARG = tsquery,
...
@@ -1154,8 +1173,10 @@ LANGUAGE C;
...
@@ -1154,8 +1173,10 @@ LANGUAGE C;
CREATE OPERATOR CLASS gist_tp_tsquery_ops
CREATE OPERATOR CLASS gist_tp_tsquery_ops
DEFAULT FOR TYPE tsquery USING gist
DEFAULT FOR TYPE tsquery USING gist
AS
AS
OPERATOR 1 @ (tsquery, tsquery) RECHECK,
OPERATOR 7 @> (tsquery, tsquery) RECHECK,
OPERATOR 2 ~ (tsquery, tsquery) RECHECK,
OPERATOR 8 <@ (tsquery, tsquery) RECHECK,
OPERATOR 13 @ (tsquery, tsquery) RECHECK,
OPERATOR 14 ~ (tsquery, tsquery) RECHECK,
FUNCTION 1 gtsq_consistent (gtsq, internal, int4),
FUNCTION 1 gtsq_consistent (gtsq, internal, int4),
FUNCTION 2 gtsq_union (bytea, internal),
FUNCTION 2 gtsq_union (bytea, internal),
FUNCTION 3 gtsq_compress (internal),
FUNCTION 3 gtsq_compress (internal),
...
...
contrib/tsearch2/untsearch.sql.in
View file @
684ad6a9
...
@@ -5,6 +5,8 @@ BEGIN;
...
@@ -5,6 +5,8 @@ BEGIN;
--in tsearch2.sql
--in tsearch2.sql
DROP OPERATOR CLASS gin_tsvector_ops USING gin CASCADE;
DROP OPERATOR CLASS gist_tsvector_ops USING gist CASCADE;
DROP OPERATOR CLASS gist_tsvector_ops USING gist CASCADE;
...
@@ -27,7 +29,7 @@ DROP TYPE gtsvector CASCADE;
...
@@ -27,7 +29,7 @@ DROP TYPE gtsvector CASCADE;
--DROP TYPE tsstat CASCADE;
--DROP TYPE tsstat CASCADE;
DROP TYPE statinfo CASCADE;
DROP TYPE statinfo CASCADE;
DROP TYPE tsdebug CASCADE;
DROP TYPE tsdebug CASCADE;
DROP TYPE gtsq CASCADE;
DROP FUNCTION lexize(oid, text) ;
DROP FUNCTION lexize(oid, text) ;
DROP FUNCTION lexize(text, text);
DROP FUNCTION lexize(text, text);
...
@@ -38,11 +40,12 @@ DROP FUNCTION dex_init(internal);
...
@@ -38,11 +40,12 @@ DROP FUNCTION dex_init(internal);
DROP FUNCTION dex_lexize(internal,internal,int4);
DROP FUNCTION dex_lexize(internal,internal,int4);
DROP FUNCTION snb_en_init(internal);
DROP FUNCTION snb_en_init(internal);
DROP FUNCTION snb_lexize(internal,internal,int4);
DROP FUNCTION snb_lexize(internal,internal,int4);
DROP FUNCTION snb_ru_init(internal);
DROP FUNCTION snb_ru_init_koi8(internal);
DROP FUNCTION snb_ru_init_utf8(internal);
DROP FUNCTION spell_init(internal);
DROP FUNCTION spell_init(internal);
DROP FUNCTION spell_lexize(internal,internal,int4);
DROP FUNCTION spell_lexize(internal,internal,int4);
DROP FUNCTION thesaurus_init(internal);
DROP FUNCTION thesaurus_init(internal);
DROP FUNCTION thesaurus_lexize(internal,internal,int4);
DROP FUNCTION thesaurus_lexize(internal,internal,int4
,internal
);
DROP FUNCTION syn_init(internal);
DROP FUNCTION syn_init(internal);
DROP FUNCTION syn_lexize(internal,internal,int4);
DROP FUNCTION syn_lexize(internal,internal,int4);
DROP FUNCTION set_curprs(int);
DROP FUNCTION set_curprs(int);
...
@@ -60,6 +63,11 @@ DROP FUNCTION gtsvector_decompress(internal);
...
@@ -60,6 +63,11 @@ DROP FUNCTION gtsvector_decompress(internal);
DROP FUNCTION gtsvector_penalty(internal,internal,internal);
DROP FUNCTION gtsvector_penalty(internal,internal,internal);
DROP FUNCTION gtsvector_picksplit(internal, internal);
DROP FUNCTION gtsvector_picksplit(internal, internal);
DROP FUNCTION gtsvector_union(internal, internal);
DROP FUNCTION gtsvector_union(internal, internal);
DROP FUNCTION gtsq_compress(internal);
DROP FUNCTION gtsq_decompress(internal);
DROP FUNCTION gtsq_penalty(internal,internal,internal);
DROP FUNCTION gtsq_picksplit(internal, internal);
DROP FUNCTION gtsq_union(bytea, internal);
DROP FUNCTION reset_tsearch();
DROP FUNCTION reset_tsearch();
DROP FUNCTION tsearch2() CASCADE;
DROP FUNCTION tsearch2() CASCADE;
DROP FUNCTION _get_parser_from_curcfg();
DROP FUNCTION _get_parser_from_curcfg();
...
...
doc/src/sgml/ref/create_opclass.sgml
View file @
684ad6a9
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.1
4 2006/01/13 18:10:25
tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_opclass.sgml,v 1.1
5 2006/09/10 17:36:52
tgl Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -238,8 +238,8 @@ CREATE OPERATOR CLASS gist__int_ops
...
@@ -238,8 +238,8 @@ CREATE OPERATOR CLASS gist__int_ops
DEFAULT FOR TYPE _int4 USING gist AS
DEFAULT FOR TYPE _int4 USING gist AS
OPERATOR 3 &&,
OPERATOR 3 &&,
OPERATOR 6 = RECHECK,
OPERATOR 6 = RECHECK,
OPERATOR 7 @,
OPERATOR 7 @
>
,
OPERATOR 8
~
,
OPERATOR 8
<@
,
OPERATOR 20 @@ (_int4, query_int),
OPERATOR 20 @@ (_int4, query_int),
FUNCTION 1 g_int_consistent (internal, _int4, int4),
FUNCTION 1 g_int_consistent (internal, _int4, int4),
FUNCTION 2 g_int_union (bytea, internal),
FUNCTION 2 g_int_union (bytea, internal),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment