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
064157b6
Commit
064157b6
authored
Mar 29, 2007
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#26624, merge to 5.1: make partition pruning module account for the
changes made by the bug fix.
parent
87d98bec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+1
-0
sql/opt_range.cc
sql/opt_range.cc
+20
-15
No files found.
mysql-test/r/subselect.result
View file @
064157b6
...
@@ -3946,6 +3946,7 @@ SELECT a FROM t1 t0
...
@@ -3946,6 +3946,7 @@ SELECT a FROM t1 t0
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
ERROR HY000: Invalid use of group function
ERROR HY000: Invalid use of group function
SET @@sql_mode=default;
SET @@sql_mode=default;
DROP TABLE t1;
CREATE TABLE t1 (s1 char(1));
CREATE TABLE t1 (s1 char(1));
INSERT INTO t1 VALUES ('a');
INSERT INTO t1 VALUES ('a');
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
...
...
sql/opt_range.cc
View file @
064157b6
...
@@ -84,7 +84,7 @@ static int sel_cmp(Field *f,char *a,char *b,uint8 a_flag,uint8 b_flag);
...
@@ -84,7 +84,7 @@ static int sel_cmp(Field *f,char *a,char *b,uint8 a_flag,uint8 b_flag);
static
char
is_null_string
[
2
]
=
{
1
,
0
};
static
char
is_null_string
[
2
]
=
{
1
,
0
};
class
RANGE_OPT_PARAM
;
/*
/*
A construction block of the SEL_ARG-graph.
A construction block of the SEL_ARG-graph.
...
@@ -356,8 +356,7 @@ class SEL_ARG :public Sql_alloc
...
@@ -356,8 +356,7 @@ class SEL_ARG :public Sql_alloc
return
new
SEL_ARG
(
field
,
part
,
min_value
,
arg
->
max_value
,
return
new
SEL_ARG
(
field
,
part
,
min_value
,
arg
->
max_value
,
min_flag
,
arg
->
max_flag
,
maybe_flag
|
arg
->
maybe_flag
);
min_flag
,
arg
->
max_flag
,
maybe_flag
|
arg
->
maybe_flag
);
}
}
SEL_ARG
*
clone
(
struct
st_qsel_param
*
param
,
SEL_ARG
*
new_parent
,
SEL_ARG
*
clone
(
RANGE_OPT_PARAM
*
param
,
SEL_ARG
*
new_parent
,
SEL_ARG
**
next
);
SEL_ARG
**
next
);
bool
copy_min
(
SEL_ARG
*
arg
)
bool
copy_min
(
SEL_ARG
*
arg
)
{
// Get overlapping range
{
// Get overlapping range
...
@@ -551,7 +550,7 @@ class SEL_ARG :public Sql_alloc
...
@@ -551,7 +550,7 @@ class SEL_ARG :public Sql_alloc
}
}
return
!
field
->
key_cmp
(
min_val
,
max_val
);
return
!
field
->
key_cmp
(
min_val
,
max_val
);
}
}
SEL_ARG
*
clone_tree
(
struct
st_qsel_param
*
param
);
SEL_ARG
*
clone_tree
(
RANGE_OPT_PARAM
*
param
);
};
};
class
SEL_IMERGE
;
class
SEL_IMERGE
;
...
@@ -631,6 +630,8 @@ class RANGE_OPT_PARAM
...
@@ -631,6 +630,8 @@ class RANGE_OPT_PARAM
using_real_indexes==TRUE
using_real_indexes==TRUE
*/
*/
uint
real_keynr
[
MAX_KEY
];
uint
real_keynr
[
MAX_KEY
];
/* Number of SEL_ARG objects allocated by SEL_ARG::clone_tree operations */
uint
alloced_sel_args
;
};
};
class
PARAM
:
public
RANGE_OPT_PARAM
class
PARAM
:
public
RANGE_OPT_PARAM
...
@@ -659,8 +660,6 @@ class PARAM : public RANGE_OPT_PARAM
...
@@ -659,8 +660,6 @@ class PARAM : public RANGE_OPT_PARAM
/* Number of ranges in the last checked tree->key */
/* Number of ranges in the last checked tree->key */
uint
n_ranges
;
uint
n_ranges
;
uint8
first_null_comp
;
/* first null component if any, 0 - otherwise */
uint8
first_null_comp
;
/* first null component if any, 0 - otherwise */
/* Number of SEL_ARG objects allocated by SEL_ARG::clone_tree operations */
uint
alloced_sel_args
;
};
};
class
TABLE_READ_PLAN
;
class
TABLE_READ_PLAN
;
...
@@ -722,8 +721,9 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg);
...
@@ -722,8 +721,9 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg);
static
SEL_TREE
*
tree_and
(
RANGE_OPT_PARAM
*
param
,
SEL_TREE
*
tree1
,
SEL_TREE
*
tree2
);
static
SEL_TREE
*
tree_and
(
RANGE_OPT_PARAM
*
param
,
SEL_TREE
*
tree1
,
SEL_TREE
*
tree2
);
static
SEL_TREE
*
tree_or
(
RANGE_OPT_PARAM
*
param
,
SEL_TREE
*
tree1
,
SEL_TREE
*
tree2
);
static
SEL_TREE
*
tree_or
(
RANGE_OPT_PARAM
*
param
,
SEL_TREE
*
tree1
,
SEL_TREE
*
tree2
);
static
SEL_ARG
*
sel_add
(
SEL_ARG
*
key1
,
SEL_ARG
*
key2
);
static
SEL_ARG
*
sel_add
(
SEL_ARG
*
key1
,
SEL_ARG
*
key2
);
static
SEL_ARG
*
key_or
(
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
);
static
SEL_ARG
*
key_or
(
RANGE_OPT_PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
);
static
SEL_ARG
*
key_and
(
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
,
uint
clone_flag
);
static
SEL_ARG
*
key_and
(
RANGE_OPT_PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
,
uint
clone_flag
);
static
bool
get_range
(
SEL_ARG
**
e1
,
SEL_ARG
**
e2
,
SEL_ARG
*
root1
);
static
bool
get_range
(
SEL_ARG
**
e1
,
SEL_ARG
**
e2
,
SEL_ARG
*
root1
);
bool
get_quick_keys
(
PARAM
*
param
,
QUICK_RANGE_SELECT
*
quick
,
KEY_PART
*
key
,
bool
get_quick_keys
(
PARAM
*
param
,
QUICK_RANGE_SELECT
*
quick
,
KEY_PART
*
key
,
SEL_ARG
*
key_tree
,
char
*
min_key
,
uint
min_key_flag
,
SEL_ARG
*
key_tree
,
char
*
min_key
,
uint
min_key_flag
,
...
@@ -1599,7 +1599,8 @@ SEL_ARG::SEL_ARG(Field *field_,uint8 part_,char *min_value_,char *max_value_,
...
@@ -1599,7 +1599,8 @@ SEL_ARG::SEL_ARG(Field *field_,uint8 part_,char *min_value_,char *max_value_,
left
=
right
=
&
null_element
;
left
=
right
=
&
null_element
;
}
}
SEL_ARG
*
SEL_ARG
::
clone
(
PARAM
*
param
,
SEL_ARG
*
new_parent
,
SEL_ARG
**
next_arg
)
SEL_ARG
*
SEL_ARG
::
clone
(
RANGE_OPT_PARAM
*
param
,
SEL_ARG
*
new_parent
,
SEL_ARG
**
next_arg
)
{
{
SEL_ARG
*
tmp
;
SEL_ARG
*
tmp
;
...
@@ -1709,7 +1710,7 @@ static int sel_cmp(Field *field, char *a,char *b,uint8 a_flag,uint8 b_flag)
...
@@ -1709,7 +1710,7 @@ static int sel_cmp(Field *field, char *a,char *b,uint8 a_flag,uint8 b_flag)
}
}
SEL_ARG
*
SEL_ARG
::
clone_tree
(
PARAM
*
param
)
SEL_ARG
*
SEL_ARG
::
clone_tree
(
RANGE_OPT_
PARAM
*
param
)
{
{
SEL_ARG
tmp_link
,
*
next_arg
,
*
root
;
SEL_ARG
tmp_link
,
*
next_arg
,
*
root
;
next_arg
=
&
tmp_link
;
next_arg
=
&
tmp_link
;
...
@@ -2609,6 +2610,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
...
@@ -2609,6 +2610,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
range_par
->
using_real_indexes
=
FALSE
;
range_par
->
using_real_indexes
=
FALSE
;
range_par
->
remove_jump_scans
=
FALSE
;
range_par
->
remove_jump_scans
=
FALSE
;
range_par
->
real_keynr
[
0
]
=
0
;
range_par
->
real_keynr
[
0
]
=
0
;
range_par
->
alloced_sel_args
=
0
;
thd
->
no_errors
=
1
;
// Don't warn about NULL
thd
->
no_errors
=
1
;
// Don't warn about NULL
thd
->
mem_root
=&
alloc
;
thd
->
mem_root
=&
alloc
;
...
@@ -6156,7 +6158,8 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
...
@@ -6156,7 +6158,8 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
/* And key trees where key1->part < key2 -> part */
/* And key trees where key1->part < key2 -> part */
static
SEL_ARG
*
static
SEL_ARG
*
and_all_keys
(
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
,
uint
clone_flag
)
and_all_keys
(
RANGE_OPT_PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
,
uint
clone_flag
)
{
{
SEL_ARG
*
next
;
SEL_ARG
*
next
;
ulong
use_count
=
key1
->
use_count
;
ulong
use_count
=
key1
->
use_count
;
...
@@ -6202,8 +6205,10 @@ and_all_keys(PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
...
@@ -6202,8 +6205,10 @@ and_all_keys(PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
SYNOPSIS
SYNOPSIS
key_and()
key_and()
key1 First argument, root of its RB-tree
param Range analysis context (needed to track if we have allocated
key2 Second argument, root of its RB-tree
too many SEL_ARGs)
key1 First argument, root of its RB-tree
key2 Second argument, root of its RB-tree
RETURN
RETURN
RB-tree root of the resulting SEL_ARG graph.
RB-tree root of the resulting SEL_ARG graph.
...
@@ -6211,7 +6216,7 @@ and_all_keys(PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
...
@@ -6211,7 +6216,7 @@ and_all_keys(PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
*/
*/
static
SEL_ARG
*
static
SEL_ARG
*
key_and
(
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
,
uint
clone_flag
)
key_and
(
RANGE_OPT_
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
,
uint
clone_flag
)
{
{
if
(
!
key1
)
if
(
!
key1
)
return
key2
;
return
key2
;
...
@@ -6350,7 +6355,7 @@ get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_ARG *root1)
...
@@ -6350,7 +6355,7 @@ get_range(SEL_ARG **e1,SEL_ARG **e2,SEL_ARG *root1)
static
SEL_ARG
*
static
SEL_ARG
*
key_or
(
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
)
key_or
(
RANGE_OPT_
PARAM
*
param
,
SEL_ARG
*
key1
,
SEL_ARG
*
key2
)
{
{
if
(
!
key1
)
if
(
!
key1
)
{
{
...
...
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