[MDEV-616] LP:1002126 - Assertion abort on SELECT @user_var Created: 2012-05-21  Updated: 2012-11-08  Resolved: 2012-11-08

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.10, 5.2.13

Type: Bug Priority: Major
Reporter: Igor Babaev Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug1002126.xml    

 Description   

The following test case causes an assertion abort in MariaDB 5.2:

CREATE TABLE t1(a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0);
SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
AS b FROM t1 GROUP BY a;
SELECT @a;
DROP TABLE t1;
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
CREATE TABLE t2(a INT);
INSERT INTO t2 VALUES (1);
SET @var=NULL;
SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
LIMIT 1;
SELECT @var;
DROP TABLE t1, t2;

The is no problem here with MaraiDB 5.5 though.



 Comments   
Comment by Igor Babaev [ 2012-05-21 ]

Re: Assertion abort on SELECT @user_var
See also bug #57196 from bugs.mysql.com

Comment by Oleksandr Byelkin [ 2012-10-02 ]

Re: Assertion abort on SELECT @user_var
The bug fixed in 5.3 and 5.5

Comment by Rasmus Johansson (Inactive) [ 2012-10-02 ]

Launchpad bug id: 1002126

Comment by Oleksandr Byelkin [ 2012-10-05 ]

It looks like 5.3 does not use 2 temporary tables here.

Comment by Oleksandr Byelkin [ 2012-10-05 ]

Here is modified test suite for 5.3 which force 2 temporary tables there and so make it crashing.

CREATE TABLE t1(a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0),(1),(3);
SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
SELECT @a;
DROP TABLE t1;

Comment by Oleksandr Byelkin [ 2012-10-08 ]

Actually innodb is not important (any engine could be used)

Comment by Oleksandr Byelkin [ 2012-10-08 ]

It is fix of other strange fix - specific behaviour for Item_func_set_user_var :

Bug#16861: User defined variable can have a wrong value if a tmp table was used.

Comment by Oleksandr Byelkin [ 2012-10-08 ]

I have strong feeling that both patches are wrong (checking...)

Comment by Oleksandr Byelkin [ 2012-10-08 ]

The MySQL workaround looks like the best. Playing with aggregate functions and split_sum* looks even more hackish.

Comment by Oleksandr Byelkin [ 2012-10-09 ]

Fix commited.

Comment by Sergei Golubchik [ 2012-10-31 ]

review: looks ok!

Comment by Timour Katchaounov (Inactive) [ 2012-11-08 ]

The patch has been pushed to 5.2, and 5.3.

Generated at Thu Feb 08 06:30:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.