Description:
For some SQL statements, the mysql client and mysqltest application return different results. For example, the statements:
SET @v = 0; SELECT @v AS pre, @v := @v + 1 AS op, @v AS post FROM t1
produces the following in mysqltest
pre op pos
0 1 0
0 2 0
0 3 0
but produces the following in mysql client
+------+------+------+
| pre | op | pos |
+------+------+------+
| 0 | 1 | 1 |
| 1 | 2 | 2 |
| 2 | 3 | 3 |
+------+------+------+
How to repeat:
Issue the following statements first in the mysql client and then using mysqltest.
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (3), (1), (2);
SET @v = 0; SELECT @v AS pre, @v := @v + 1 AS op, @v AS pos FROM t1;
Suggested fix:
Both mysqltest and the mysql client application should return the same results.
The mysql client is correct.