Column type for aggregate column created from select does not match MySQL
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 108
Description
MySQL
```
mysql> create table t1 (i int);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into t1 values (1);
Query OK, 1 row affected (0.00 sec)
mysql> create table t2 select sum(i) from t1;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> show create table t2;
+-------+------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------------------------------------------------------------------+
| t2 | CREATE TABLE `t2` (
`sum(i)` decimal(32,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
+-------+------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
Dolt
```
tmp/main*> create table t1 (i int);
Query OK, 0 rows affected (0.01 sec)
tmp/main*> insert into t1 values (1);
Query OK, 1 row affected (0.01 sec)
tmp/main*> create table t2 select sum(i) from t1;
Query OK, 1 row affected (0.01 sec)
tmp/main*> show create table t2;
+-------+------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------+
| t2 | CREATE TABLE `t2` ( |
| | `sum(t1.i)` double NOT NULL |
| | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin |
+-------+------------------------------------------------------------------+
1 row in set (0.00 sec)
```
Column is `decimal(32,0) DEFAULT NULL` in MySQL but `double NOT NULL` in Dolt. TODO added in dolthub/go-mysql-server#3182
Column name is fixed in dolthub/vitess#430
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.