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

There is a problem adding an index to a generated column with an expression error. #9214

Closed
zimulala opened this issue Jan 29, 2019 · 0 comments
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@zimulala
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
create table t(
  y year NOT NULL DEFAULT '2155'
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into t values();
ALTER TABLE t ADD COLUMN y1 year as (y + 2);
ALTER TABLE t ADD INDEX idx_y(y1);
  1. What did you expect to see?
mysql> create table t(
    ->   y year NOT NULL DEFAULT '2155'
    -> )ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t values();
Query OK, 1 row affected (0.00 sec)

mysql> ALTER TABLE t ADD COLUMN y1 year as (y + 2);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE t ADD INDEX idx_y(y1);
ERROR 1264 (22003): Out of range value for column 'y1' at row 1
  1. What did you see instead?
    Executing this statement of ALTER TABLE t ADD INDEX idx_y(y1); will get stuck.

  2. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    Release Version: v3.0.0-beta-18-g7648317da
    Git Commit Hash: 7648317
    Git Branch: master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant