dolthub / dolthub/dolt

Ordering by the primary key changes the order of results incorrectly

Open
#9,836 0 comments 0 reactions 0 assignees View on GitHub
bug correctness sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

Tests added in dolthub/go-mysql-server#3204.

**MySQL**
```
mysql> SELECT pk, cast(pk as signed) FROM test_cast ORDER BY pk;
+-----------------+--------------------+
| pk | cast(pk as signed) |
+-----------------+--------------------+
| 3 12 4 | 3 |
| -3.1234 | -3 |
| -3.1a | -3 |
| -5+8 | -5 |
| +3.1234 | 3 |
| 11-5 | 11 |
| 1a1 | 1 |
| 2,345 | 2 |
| 3. 12 4 | 3 |
| 3.2 12 4 | 3 |
| 4,12 | 4 |
| 5.932887e+07 | 5 |
| 5.932887e+07abc | 5 |
| 5.932887e7 | 5 |
| 5.932887e7abc | 5 |
| a1a1 | 0 |
+-----------------+--------------------+
16 rows in set, 16 warnings (0.009 sec)
```

**Dolt**
```
9812/main*> SELECT pk, cast(pk as signed) FROM test_cast ORDER BY pk;
+-----------------+--------------------+
| pk | cast(pk as signed) |
+-----------------+--------------------+
| 3 12 4 | 3 |
| +3.1234 | 3 |
| -3.1234 | -3 |
| -3.1a | -3 |
| -5+8 | -5 |
| 11-5 | 11 |
| 1a1 | 1 |
| 2,345 | 2 |
| 3. 12 4 | 3 |
| 3.2 12 4 | 3 |
| 4,12 | 4 |
| 5.932887e+07 | 5 |
| 5.932887e+07abc | 5 |
| 5.932887e7 | 5 |
| 5.932887e7abc | 5 |
| a1a1 | 0 |
+-----------------+--------------------+
16 rows in set (0.00 sec)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.