mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
An user assignment variable expression that's evaluated in a logical expression context (Item::val_bool()) can be pre-calculated in a temporary table for GROUP BY. However when the expression value is used after the temp table creation it was re-evaluated instead of being read from the temp table due to a missing val_bool_result() method. Fixed by implementing the method.
This commit is contained in:
@@ -430,4 +430,21 @@ 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
|
||||
|
@@ -328,4 +328,22 @@ 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
|
||||
|
Reference in New Issue
Block a user