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
2ecc81cb
Commit
2ecc81cb
authored
Aug 13, 2010
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
d8f8b1cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
0 deletions
+44
-0
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+17
-0
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+18
-0
sql/item_func.cc
sql/item_func.cc
+8
-0
sql/item_func.h
sql/item_func.h
+1
-0
No files found.
mysql-test/r/user_var.result
View file @
2ecc81cb
...
...
@@ -428,6 +428,23 @@ CREATE TRIGGER t_after_insert AFTER INSERT ON t1 FOR EACH ROW SET @bug42188 = 10
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
# BUG#55615 : should not crash
SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a;
(@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1)
1
1
# BUG#55564 : should not crash
SELECT IF(
@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a),
count(*), 1)
FROM t1 GROUP BY a LIMIT 1;
IF(
@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a),
count(*), 1)
1
DROP TABLE t1;
End of 5.1 tests
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
...
...
mysql-test/t/user_var.test
View file @
2ecc81cb
...
...
@@ -326,6 +326,24 @@ INSERT INTO t1 VALUES (1);
INSERT
INTO
t1
VALUES
(
1
);
DROP
TABLE
t1
;
#
# Bug #55615: debug assertion after using variable in assignment and
# referred to
# Bug #55564: crash with user variables, assignments, joins...
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
0
),(
0
);
--
echo
# BUG#55615 : should not crash
SELECT
(
@
a
:=
(
SELECT
@
a
:=
1
FROM
t1
LIMIT
1
))
AND
COUNT
(
1
)
FROM
t1
GROUP
BY
@
a
;
--
echo
# BUG#55564 : should not crash
SELECT
IF
(
@
v
:=
LEAST
((
SELECT
1
FROM
t1
t2
LEFT
JOIN
t1
ON
(
@
v
)
GROUP
BY
t1
.
a
),
a
),
count
(
*
),
1
)
FROM
t1
GROUP
BY
a
LIMIT
1
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
#
...
...
sql/item_func.cc
View file @
2ecc81cb
...
...
@@ -4621,6 +4621,14 @@ longlong Item_func_set_user_var::val_int_result()
return
entry
->
val_int
(
&
null_value
);
}
bool
Item_func_set_user_var
::
val_bool_result
()
{
DBUG_ASSERT
(
fixed
==
1
);
check
(
TRUE
);
update
();
// Store expression
return
entry
->
val_int
(
&
null_value
)
!=
0
;
}
String
*
Item_func_set_user_var
::
str_result
(
String
*
str
)
{
DBUG_ASSERT
(
fixed
==
1
);
...
...
sql/item_func.h
View file @
2ecc81cb
...
...
@@ -1416,6 +1416,7 @@ class Item_func_set_user_var :public Item_func
my_decimal
*
val_decimal
(
my_decimal
*
);
double
val_result
();
longlong
val_int_result
();
bool
val_bool_result
();
String
*
str_result
(
String
*
str
);
my_decimal
*
val_decimal_result
(
my_decimal
*
);
bool
is_null_result
();
...
...
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