You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Primary key columns are often defined as int or bigint, which by default are signed. As negative values are often not used and growing out of an integer type is common it would be good to allow the PK to change from int to int unsigned and from bigint to bigint unsigned.
Changing this for smaller integer types is less important ans rebuilding smaller tables is often less of an issue.
Currently the user has to rebuild the table by creating a new table, copying data and then switching tables. Doing this without downtime is often difficult.
If changing an int to bigint is also possible this would be very helpful as well.
Current behaviour:
sql> CREATE TABLE t1(id bigint PRIMARY KEY, c1 bigint);
Query OK, 0 rows affected (0.0153 sec)
sql> INSERT INTO t1 VALUES(1,1),(1000,1000);
Query OK, 2 rows affected (0.0022 sec)
Records: 2 Duplicates: 0 Warnings: 0
sql> ALTER TABLE t1 MODIFY COLUMN id bigint unsigned;
ERROR: 8200 (HY000): Unsupported modify column: this column has primary key flag
mjonss
changed the title
Allow chaning the primary key from an signed integer type to an unsigned integer type
Allow changing the primary key from an signed integer type to an unsigned integer type
Oct 13, 2022
Feature Request
Primary key columns are often defined as
int
orbigint
, which by default are signed. As negative values are often not used and growing out of an integer type is common it would be good to allow the PK to change fromint
toint unsigned
and frombigint
tobigint unsigned
.Changing this for smaller integer types is less important ans rebuilding smaller tables is often less of an issue.
Currently the user has to rebuild the table by creating a new table, copying data and then switching tables. Doing this without downtime is often difficult.
If changing an
int
tobigint
is also possible this would be very helpful as well.Current behaviour:
Suggested behaviour:
The suggested behaviour works if I sabotage the check in TiDB. I only tried with the unistore and without testing indexes etc.
The text was updated successfully, but these errors were encountered: