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
87d98bec
Commit
87d98bec
authored
Mar 29, 2007
by
sergefp@pylon.mylan
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/psergey/mysql-5.0-merge
into mysql.com:/home/psergey/mysql-5.1-merge
parents
10185729
399bc986
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
247 additions
and
36 deletions
+247
-36
mysql-test/r/range.result
mysql-test/r/range.result
+28
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+22
-0
mysql-test/t/range.test
mysql-test/t/range.test
+32
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+25
-0
sql/item_sum.cc
sql/item_sum.cc
+5
-2
sql/opt_range.cc
sql/opt_range.cc
+132
-31
sql/sql_list.h
sql/sql_list.h
+3
-3
No files found.
mysql-test/r/range.result
View file @
87d98bec
...
...
@@ -717,6 +717,34 @@ d8c4177d225791924.30714720
d8c4177d2380fc201.39666693
d8c4177d24ccef970.14957924
DROP TABLE t1;
create table t1 (
c1 char(10), c2 char(10), c3 char(10), c4 char(10),
c5 char(10), c6 char(10), c7 char(10), c8 char(10),
c9 char(10), c10 char(10), c11 char(10), c12 char(10),
c13 char(10), c14 char(10), c15 char(10), c16 char(10),
index(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,c13,c14,c15,c16)
);
insert into t1 (c1) values ('1'),('1'),('1'),('1');
select * from t1 where
c1 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c2 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c3 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c4 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c5 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c6 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c7 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c8 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c9 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c11 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c12 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c13 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c14 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c15 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
and c16 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh")
;
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
drop table t1;
End of 4.1 tests
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
...
...
mysql-test/r/subselect.result
View file @
87d98bec
...
...
@@ -3924,6 +3924,28 @@ c a (SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
3 3 4
1 4 2,2
DROP table t1,t2;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
a
1
2
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
a
SELECT a FROM t1 t0
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
a
1
2
SET @@sql_mode='ansi';
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
ERROR HY000: Invalid use of group function
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
ERROR HY000: Invalid use of group function
SELECT a FROM t1 t0
WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
ERROR HY000: Invalid use of group function
SET @@sql_mode=default;
CREATE TABLE t1 (s1 char(1));
INSERT INTO t1 VALUES ('a');
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
...
...
mysql-test/t/range.test
View file @
87d98bec
...
...
@@ -568,6 +568,38 @@ SELECT s.oxid FROM t1 v, t1 s
DROP
TABLE
t1
;
# BUG#26624 high mem usage (crash) in range optimizer (depends on order of fields in where)
create
table
t1
(
c1
char
(
10
),
c2
char
(
10
),
c3
char
(
10
),
c4
char
(
10
),
c5
char
(
10
),
c6
char
(
10
),
c7
char
(
10
),
c8
char
(
10
),
c9
char
(
10
),
c10
char
(
10
),
c11
char
(
10
),
c12
char
(
10
),
c13
char
(
10
),
c14
char
(
10
),
c15
char
(
10
),
c16
char
(
10
),
index
(
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
,
c10
,
c11
,
c12
,
c13
,
c14
,
c15
,
c16
)
);
insert
into
t1
(
c1
)
values
(
'1'
),(
'1'
),(
'1'
),(
'1'
);
# This must run without crash and fast:
select
*
from
t1
where
c1
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c2
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c3
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c4
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c5
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c6
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c7
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c8
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c9
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c10
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c11
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c12
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c13
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c14
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c15
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
and
c16
in
(
"abcdefgh"
,
"123456789"
,
"qwertyuio"
,
"asddfgh"
)
;
drop
table
t1
;
--
echo
End
of
4.1
tests
#
...
...
mysql-test/t/subselect.test
View file @
87d98bec
...
...
@@ -2784,6 +2784,31 @@ SELECT COUNT(*) c, a,
DROP
table
t1
,
t2
;
#
# Bug #27348: SET FUNCTION used in a subquery from WHERE condition
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
INSERT
INTO
t1
VALUES
(
2
,
22
),(
1
,
11
),(
2
,
22
);
SELECT
a
FROM
t1
WHERE
(
SELECT
COUNT
(
b
)
FROM
DUAL
)
>
0
GROUP
BY
a
;
SELECT
a
FROM
t1
WHERE
(
SELECT
COUNT
(
b
)
FROM
DUAL
)
>
1
GROUP
BY
a
;
SELECT
a
FROM
t1
t0
WHERE
(
SELECT
COUNT
(
t0
.
b
)
FROM
t1
t
WHERE
t
.
b
>
20
)
GROUP
BY
a
;
SET
@@
sql_mode
=
'ansi'
;
--
error
1111
SELECT
a
FROM
t1
WHERE
(
SELECT
COUNT
(
b
)
FROM
DUAL
)
>
0
GROUP
BY
a
;
--
error
1111
SELECT
a
FROM
t1
WHERE
(
SELECT
COUNT
(
b
)
FROM
DUAL
)
>
1
GROUP
BY
a
;
--
error
1111
SELECT
a
FROM
t1
t0
WHERE
(
SELECT
COUNT
(
t0
.
b
)
FROM
t1
t
WHERE
t
.
b
>
20
)
GROUP
BY
a
;
SET
@@
sql_mode
=
default
;
DROP
TABLE
t1
;
# Bug#20835 (literal string with =any values)
#
CREATE
TABLE
t1
(
s1
char
(
1
));
...
...
sql/item_sum.cc
View file @
87d98bec
...
...
@@ -149,6 +149,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
if
(
register_sum_func
(
thd
,
ref
))
return
TRUE
;
invalid
=
aggr_level
<
0
&&
!
(
allow_sum_func
&
(
1
<<
nest_level
));
if
(
!
invalid
&&
thd
->
variables
.
sql_mode
&
MODE_ANSI
)
invalid
=
aggr_level
<
0
&&
max_arg_level
<
nest_level
;
}
if
(
!
invalid
&&
aggr_level
<
0
)
{
...
...
@@ -165,6 +167,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
are acceptable here: they are not, if the level of aggregation of
some of them is less than aggr_level.
*/
if
(
!
invalid
)
invalid
=
aggr_level
<=
max_sum_func_level
;
if
(
invalid
)
{
...
...
sql/opt_range.cc
View file @
87d98bec
This diff is collapsed.
Click to expand it.
sql/sql_list.h
View file @
87d98bec
...
...
@@ -23,7 +23,7 @@
class
Sql_alloc
{
public:
static
void
*
operator
new
(
size_t
size
)
static
void
*
operator
new
(
size_t
size
)
throw
()
{
return
(
void
*
)
sql_alloc
((
uint
)
size
);
}
...
...
@@ -31,9 +31,9 @@ class Sql_alloc
{
return
(
void
*
)
sql_alloc
((
uint
)
size
);
}
static
void
*
operator
new
[](
size_t
size
,
MEM_ROOT
*
mem_root
)
static
void
*
operator
new
[](
size_t
size
,
MEM_ROOT
*
mem_root
)
throw
()
{
return
(
void
*
)
alloc_root
(
mem_root
,
(
uint
)
size
);
}
static
void
*
operator
new
(
size_t
size
,
MEM_ROOT
*
mem_root
)
static
void
*
operator
new
(
size_t
size
,
MEM_ROOT
*
mem_root
)
throw
()
{
return
(
void
*
)
alloc_root
(
mem_root
,
(
uint
)
size
);
}
static
void
operator
delete
(
void
*
ptr
,
size_t
size
)
{
TRASH
(
ptr
,
size
);
}
static
void
operator
delete
(
void
*
ptr
,
MEM_ROOT
*
mem_root
)
...
...
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