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
279b50b4
Commit
279b50b4
authored
Apr 22, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-14041 Server crashes in String::length on queries with functions and ROLLUP
parent
f4b27400
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
4 deletions
+108
-4
mysql-test/r/olap.result
mysql-test/r/olap.result
+40
-0
mysql-test/t/olap.test
mysql-test/t/olap.test
+22
-0
sql/item.h
sql/item.h
+39
-0
sql/item_func.h
sql/item_func.h
+7
-4
No files found.
mysql-test/r/olap.result
View file @
279b50b4
...
@@ -800,5 +800,45 @@ latin1
...
@@ -800,5 +800,45 @@ latin1
binary
binary
DROP TABLE t;
DROP TABLE t;
#
#
# MDEV-14041 Server crashes in String::length on queries with functions and ROLLUP
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
SELECT GET_LOCK( 'foo', 0 );
GET_LOCK( 'foo', 0 )
1
SELECT HEX( RELEASE_LOCK( 'foo' ) ) AS f FROM t1 GROUP BY f WITH ROLLUP;
f
NULL
1
NULL
DROP TABLE t1;
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
SELECT i FROM t1 GROUP BY i WITH ROLLUP
UNION ALL
SELECT ELT( FOUND_ROWS(), 1 ) f FROM t1 GROUP BY f WITH ROLLUP;
i
1
2
NULL
NULL
NULL
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT a FROM t1 GROUP BY NULLIF( CONVERT('', DATE), '2015-10-15' ) WITH ROLLUP;
a
1
1
Warnings:
Warning 1292 Incorrect datetime value: ''
Warning 1292 Incorrect datetime value: ''
Warning 1292 Incorrect datetime value: ''
Warning 1292 Incorrect datetime value: ''
Warning 1292 Incorrect datetime value: ''
Warning 1292 Incorrect datetime value: ''
DROP TABLE t1;
#
# End of 10.1 tests
# End of 10.1 tests
#
#
mysql-test/t/olap.test
View file @
279b50b4
...
@@ -439,6 +439,28 @@ SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP;
...
@@ -439,6 +439,28 @@ SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP;
DROP
TABLE
t
;
DROP
TABLE
t
;
--
echo
#
--
echo
# MDEV-14041 Server crashes in String::length on queries with functions and ROLLUP
--
echo
#
CREATE
TABLE
t1
(
i
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
SELECT
GET_LOCK
(
'foo'
,
0
);
SELECT
HEX
(
RELEASE_LOCK
(
'foo'
)
)
AS
f
FROM
t1
GROUP
BY
f
WITH
ROLLUP
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
i
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
SELECT
i
FROM
t1
GROUP
BY
i
WITH
ROLLUP
UNION
ALL
SELECT
ELT
(
FOUND_ROWS
(),
1
)
f
FROM
t1
GROUP
BY
f
WITH
ROLLUP
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
SELECT
a
FROM
t1
GROUP
BY
NULLIF
(
CONVERT
(
''
,
DATE
),
'2015-10-15'
)
WITH
ROLLUP
;
DROP
TABLE
t1
;
--
echo
#
--
echo
#
--
echo
# End of 10.1 tests
--
echo
# End of 10.1 tests
--
echo
#
--
echo
#
sql/item.h
View file @
279b50b4
...
@@ -663,6 +663,45 @@ class Item: public Value_source,
...
@@ -663,6 +663,45 @@ class Item: public Value_source,
SEL_TREE
*
get_mm_tree_for_const
(
RANGE_OPT_PARAM
*
param
);
SEL_TREE
*
get_mm_tree_for_const
(
RANGE_OPT_PARAM
*
param
);
Field
*
create_tmp_field
(
bool
group
,
TABLE
*
table
,
uint
convert_int_length
);
Field
*
create_tmp_field
(
bool
group
,
TABLE
*
table
,
uint
convert_int_length
);
/* Helper methods, to get an Item value from another Item */
double
val_real_from_item
(
Item
*
item
)
{
DBUG_ASSERT
(
fixed
==
1
);
double
value
=
item
->
val_real
();
null_value
=
item
->
null_value
;
return
value
;
}
longlong
val_int_from_item
(
Item
*
item
)
{
DBUG_ASSERT
(
fixed
==
1
);
longlong
value
=
item
->
val_int
();
null_value
=
item
->
null_value
;
return
value
;
}
String
*
val_str_from_item
(
Item
*
item
,
String
*
str
)
{
DBUG_ASSERT
(
fixed
==
1
);
String
*
res
=
item
->
val_str
(
str
);
if
(
res
)
res
->
set_charset
(
collation
.
collation
);
if
((
null_value
=
item
->
null_value
))
res
=
NULL
;
return
res
;
}
my_decimal
*
val_decimal_from_item
(
Item
*
item
,
my_decimal
*
decimal_value
)
{
DBUG_ASSERT
(
fixed
==
1
);
my_decimal
*
value
=
item
->
val_decimal
(
decimal_value
);
if
((
null_value
=
item
->
null_value
))
value
=
NULL
;
return
value
;
}
bool
get_date_from_item
(
Item
*
item
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
bool
rc
=
item
->
get_date
(
ltime
,
fuzzydate
);
null_value
=
MY_TEST
(
rc
||
item
->
null_value
);
return
rc
;
}
/*
/*
This method is used if the item was not null but convertion to
This method is used if the item was not null but convertion to
TIME/DATE/DATETIME failed. We return a zero date if allowed,
TIME/DATE/DATETIME failed. We return a zero date if allowed,
...
...
sql/item_func.h
View file @
279b50b4
...
@@ -1120,10 +1120,13 @@ class Item_func_rollup_const :public Item_func
...
@@ -1120,10 +1120,13 @@ class Item_func_rollup_const :public Item_func
name
=
a
->
name
;
name
=
a
->
name
;
name_length
=
a
->
name_length
;
name_length
=
a
->
name_length
;
}
}
double
val_real
()
{
return
args
[
0
]
->
val_real
();
}
double
val_real
()
{
return
val_real_from_item
(
args
[
0
]);
}
longlong
val_int
()
{
return
args
[
0
]
->
val_int
();
}
longlong
val_int
()
{
return
val_int_from_item
(
args
[
0
]);
}
String
*
val_str
(
String
*
str
)
{
return
args
[
0
]
->
val_str
(
str
);
}
String
*
val_str
(
String
*
str
)
{
return
val_str_from_item
(
args
[
0
],
str
);
}
my_decimal
*
val_decimal
(
my_decimal
*
dec
)
{
return
args
[
0
]
->
val_decimal
(
dec
);
}
my_decimal
*
val_decimal
(
my_decimal
*
dec
)
{
return
val_decimal_from_item
(
args
[
0
],
dec
);
}
bool
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
return
get_date_from_item
(
args
[
0
],
ltime
,
fuzzydate
);
}
const
char
*
func_name
()
const
{
return
"rollup_const"
;
}
const
char
*
func_name
()
const
{
return
"rollup_const"
;
}
bool
const_item
()
const
{
return
0
;
}
bool
const_item
()
const
{
return
0
;
}
Item_result
result_type
()
const
{
return
args
[
0
]
->
result_type
();
}
Item_result
result_type
()
const
{
return
args
[
0
]
->
result_type
();
}
...
...
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