dolthub / dolthub/dolt

`SHOW CREATE` doesn't show indexes on virtual generated columns:

Closed
#8,275 1 comment 0 reactions 1 assignee Claimed by @zachmu View on GitHub
bug correctness indexes sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

To reproduce:

```
create table t(a int primary key, b int generated always as (a*a), unique key (b));
show create table t;
```
Result:
```
+-------+------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------+
| t | CREATE TABLE `t` ( |
| | `a` int NOT NULL, |
| | `b` int GENERATED ALWAYS AS ((`a` * `a`)), |
| | PRIMARY KEY (`a`) |
| | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin |
+-------+------------------------------------------------------------------+
```
The index is present, and functions, as seen here:
```
> insert into t(a) values (2), (-2);
duplicate unique key given: [4]
```
But it is omitted from `SHOW CREATE` statements. This happens both in Dolt and in GMS.

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.