Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.4
-
None
Description
There is an inconsistency in the results when using the NULLIF function on a BIT and FLOAT column in the same query versus storing the result in another table.
Set up table t0:
CREATE TABLE t0 (c0 BIT, c1 FLOAT); |
INSERT INTO t0 VALUES (1, 6.26034297557673e+37); |
Use NULLIF in a SELECT query:
SELECT (NULLIF(t0.c0, t0.c1)) AS c0 FROM t0; |
--Result: 49 |
Store the result of NULLIF in another table t1 and SELECT:
CREATE TABLE t1 AS (SELECT (NULLIF(t0.c0, t0.c1)) AS c0 FROM t0); |
SELECT * FROM t1; |
--Result: 1 |
Can also see: https://dbfiddle.uk/4sKLsbL9
The result should be consistent regardless of whether the result is directly selected or stored in another table.
Attachments
Issue Links
- is duplicated by
-
MDEV-34797 Inconsistency in the results when using the COALESCE function
-
- Closed
-
it's not 49 and 1, it's CHAR(49) and CHAR(1), for some reason dbfiddle shows ascii code of the result. Doesn't matter, the result is still different.
This stems from different behavior of bit_field->val_str() (which is Field_bit::val_str() and bit_expr->val_str() which is