Skip to content

bad conversion between string and decimal types with trailing 0s #7351

@jycor

Description

@jycor

When converting between strings and decimals for HASH IN <tuple> expressions, trailing 0s cause a problems.

There's a skipped test added in this PR:
dolthub/go-mysql-server#2267

Setup:

create table t (v varchar(100));
insert into t values ('0'), ('0.0'), ('123'), ('123.0');
create table t_idx (v varchar(100));
create index idx on t_idx(v);
insert into t_idx values ('0'), ('0.0'), ('123'), ('123.0');

MySQL:

mysql> select * from t where (v in (0.0, 123));
+-------+
| v     |
+-------+
| 0     |
| 0.0   |
| 123   |
| 123.0 |
+-------+
4 rows in set (0.0343 sec)
mysql> select * from t_idx where (v in (0.0, 123));
+-------+
| v     |
+-------+
| 0     |
| 0.0   |
| 123   |
| 123.0 |
+-------+
4 rows in set (0.0069 sec)

Dolt:

tmp> select * from t where (v in (0.0, 123));
+-----+
| v   |
+-----+
| 123 |
+-----+
1 row in set (0.00 sec)

tmp> select * from t_idx where (v in (0.0, 123));
+-----+
| v   |
+-----+
| 123 |
+-----+
1 row in set (0.01 sec)

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzercorrectnessWe don't return the same result as MySQLsqlIssue with SQL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions