Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
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
nexedi
MariaDB
Commits
ebce10c3
Commit
ebce10c3
authored
Aug 26, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix (Bug#5219: Cannot use '||' with MBRContains(..)).
parent
8aee2005
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
5 deletions
+49
-5
mysql-test/r/gis.result
mysql-test/r/gis.result
+19
-0
mysql-test/t/gis.test
mysql-test/t/gis.test
+18
-0
sql/opt_range.cc
sql/opt_range.cc
+12
-5
No files found.
mysql-test/r/gis.result
View file @
ebce10c3
...
@@ -466,3 +466,22 @@ insert IGNORE into t1 values ('Garbage');
...
@@ -466,3 +466,22 @@ insert IGNORE into t1 values ('Garbage');
ERROR HY000: Unknown error
ERROR HY000: Unknown error
alter table t1 add spatial index(a);
alter table t1 add spatial index(a);
drop table t1;
drop table t1;
create table t1(a geometry not null, spatial index(a));
insert into t1 values
(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
or
MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
AsText(a)
POINT(1 1)
POINT(3 3)
POINT(4 4)
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
and
MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
AsText(a)
POINT(1 1)
drop table t1;
mysql-test/t/gis.test
View file @
ebce10c3
...
@@ -172,3 +172,21 @@ insert IGNORE into t1 values ('Garbage');
...
@@ -172,3 +172,21 @@ insert IGNORE into t1 values ('Garbage');
alter
table
t1
add
spatial
index
(
a
);
alter
table
t1
add
spatial
index
(
a
);
drop
table
t1
;
drop
table
t1
;
#
# Bug #5219: problem with range optimizer
#
create
table
t1
(
a
geometry
not
null
,
spatial
index
(
a
));
insert
into
t1
values
(
GeomFromText
(
'POINT(1 1)'
)),
(
GeomFromText
(
'POINT(3 3)'
)),
(
GeomFromText
(
'POINT(4 4)'
)),
(
GeomFromText
(
'POINT(6 6)'
));
select
AsText
(
a
)
from
t1
where
MBRContains
(
GeomFromText
(
'Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'
),
a
)
or
MBRContains
(
GeomFromText
(
'Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'
),
a
);
select
AsText
(
a
)
from
t1
where
MBRContains
(
GeomFromText
(
'Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'
),
a
)
and
MBRContains
(
GeomFromText
(
'Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'
),
a
);
drop
table
t1
;
sql/opt_range.cc
View file @
ebce10c3
...
@@ -1302,14 +1302,14 @@ tree_and(PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
...
@@ -1302,14 +1302,14 @@ tree_and(PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
if
(
*
key2
&&
!
(
*
key2
)
->
simple_key
())
if
(
*
key2
&&
!
(
*
key2
)
->
simple_key
())
flag
|=
CLONE_KEY2_MAYBE
;
flag
|=
CLONE_KEY2_MAYBE
;
*
key1
=
key_and
(
*
key1
,
*
key2
,
flag
);
*
key1
=
key_and
(
*
key1
,
*
key2
,
flag
);
if
((
*
key1
)
->
type
==
SEL_ARG
::
IMPOSSIBLE
)
if
(
*
key1
&&
(
*
key1
)
->
type
==
SEL_ARG
::
IMPOSSIBLE
)
{
{
tree1
->
type
=
SEL_TREE
::
IMPOSSIBLE
;
tree1
->
type
=
SEL_TREE
::
IMPOSSIBLE
;
break
;
}
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG
(
*
key1
)
->
test_use_count
(
*
key1
);
(
*
key1
)
->
test_use_count
(
*
key1
);
#endif
#endif
break
;
}
}
}
}
}
DBUG_RETURN
(
tree1
);
DBUG_RETURN
(
tree1
);
...
@@ -1401,6 +1401,12 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
...
@@ -1401,6 +1401,12 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
return
key2
;
return
key2
;
if
(
!
key2
)
if
(
!
key2
)
return
key1
;
return
key1
;
if
((
key1
->
min_flag
|
key2
->
min_flag
)
&
GEOM_FLAG
)
{
key1
->
free_tree
();
key2
->
free_tree
();
return
0
;
// Can't optimize this
}
if
(
key1
->
part
!=
key2
->
part
)
if
(
key1
->
part
!=
key2
->
part
)
{
{
if
(
key1
->
part
>
key2
->
part
)
if
(
key1
->
part
>
key2
->
part
)
...
@@ -1538,7 +1544,8 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
...
@@ -1538,7 +1544,8 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
key1
->
use_count
--
;
key1
->
use_count
--
;
key2
->
use_count
--
;
key2
->
use_count
--
;
if
(
key1
->
part
!=
key2
->
part
)
if
(
key1
->
part
!=
key2
->
part
||
(
key1
->
min_flag
|
key2
->
min_flag
)
&
GEOM_FLAG
)
{
{
key1
->
free_tree
();
key1
->
free_tree
();
key2
->
free_tree
();
key2
->
free_tree
();
...
...
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