[MDEV-12852] Out-of-range errors when CAST(1-2 AS UNSIGNED) Created: 2017-05-19 Updated: 2017-05-23 Resolved: 2017-05-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.3.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | datatype | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
This problem is repeatable in 10.2 with the default sql_mode, as well as in 10.1 with sql_mode=STRICT_ALL_TABLES. It's very similar to Cast -1 as UNSIGNED returns 18446744073709551615. This script proves that:
Now I want to create a table from the result of the same SELECT query. It unexpectedly returns an error:
Adding LIMIT 0 helps to figure out what's going on:
Notice, the column type is wrong. The expected column type should be BIGINT for both columns, to be able to store 18446744073709551615. |
| Comments |
| Comment by Alexander Barkov [ 2017-05-23 ] |
|
Pushed into bb-10.2-ext |