Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nicktobey opened this issue Aug 15, 2024 · 1 comment
Open

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

nicktobey opened this issue Aug 15, 2024 · 1 comment
Labels
bug Something isn't working correctness We don't return the same result as MySQL sql Issue with SQL

Comments

@nicktobey
Copy link
Contributor

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.

@nicktobey
Copy link
Contributor Author

Of note, this only happens with virtual generated columns. Indexes on stored generated columns display as normal.

@timsehn timsehn added bug Something isn't working sql Issue with SQL correctness We don't return the same result as MySQL labels Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness We don't return the same result as MySQL sql Issue with SQL
Projects
None yet
Development

No branches or pull requests

2 participants