Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.6, 10.11, 11.4, 10.5(EOL)
-
None
Description
I set up table t0 as follows:
CREATE TABLE t0 (c0 MEDIUMTEXT, c1 MEDIUMBLOB); |
INSERT INTO t0 VALUES ('936LhMOCwtzb5PBoylz1Ump78m3RylLzmIpizsJdU1tjb98Z16tECKRskGg5ahvX0ybhuMzrdhgySWouDdeAb3hftoNL5184An3nzpSKNik24PEBeHBJZC2X2e', 'Eb8LgJMjqRviaIKfcga8YnK1783Gxeo7zlti59Xrv29oZVPsOqokVzPem8j8Kvy4laIEVxoPffbhTft0'); |
Next, I create another table t1 to store the result of the GREATEST function applied to t0.c0 and t0.c1 as follows:
CREATE TABLE t1 AS (SELECT (GREATEST(t0.c0, t0.c1)) AS c0 FROM t0); |
Therefore, the value of t1.c0 equals the result of the GREATEST function. However, when I used t1.c0 instead of directly applying the GREATEST function to execute the SELECT statement, I got different results. This might be a bug.
t1.c0 version SELECT and Result:
SELECT t1.c0 FROM t1 WHERE (t1.c0 <= (SELECT COUNT(t1.c0) FROM t1)); |
|
Result:
|
+----------------------------------------------------------------------------------+ |
| c0 |
|
+----------------------------------------------------------------------------------+ |
| Eb8LgJMjqRviaIKfcga8YnK1783Gxeo7zlti59Xrv29oZVPsOqokVzPem8j8Kvy4laIEVxoPffbhTft0 |
|
+----------------------------------------------------------------------------------+ |
GREATEST version SELECT and Result:
SELECT (GREATEST(t0.c0, t0.c1)) FROM t0 WHERE ((GREATEST(t0.c0, t0.c1)) <= (SELECT COUNT((GREATEST(t0.c0, t0.c1))) FROM t0)); |
|
Result:
|
Empty set |
Expected behavior:
The two SELECTs return same result.
Attachments
Issue Links
- duplicates
-
MDEV-5893 CAST(LEAST('11','2') AS DECIMAL) returns a wrong result
-
- Confirmed
-