[MDEV-16373] Wrong results for a query with two NAME_CONST() Created: 2018-06-01  Updated: 2022-12-07

Status: Confirmed
Project: MariaDB Server
Component/s: Data types, Optimizer
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.3

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None

Epic Link: Data type cleanups

 Description   

This script:

CREATE OR REPLACE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1 WHERE a BETWEEN NAME_CONST('x',1) AND NAME_CONST('y',2);

returns a correct result:

+------+
| a    |
+------+
|    1 |
|    2 |
+------+

Now I change the name in the second NAME_CONST() from 'x' to 'y', the script returns a wrong result:

CREATE OR REPLACE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1 WHERE a BETWEEN NAME_CONST('x',1) AND NAME_CONST('x',2);

+------+
| a    |
+------+
|    1 |
+------+


Generated at Thu Feb 08 08:28:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.