Open jd-zhang opened 3 years ago
case likewise:
drop table if exists itest6; CREATE TABLE itest6 (a int GENERATED ALWAYS AS IDENTITY, b text); INSERT INTO itest6 DEFAULT VALUES; ALTER TABLE itest6 ALTER COLUMN a SET GENERATED BY DEFAULT SET INCREMENT BY 2 SET START WITH 100 RESTART; INSERT INTO itest6 DEFAULT VALUES; INSERT INTO itest6 DEFAULT VALUES; SELECT * FROM itest6 order by 1,2;
For kunlun, the result is: a | b 1 | 102 | 104 |
For official pg, the result is: a | b 1 | 100 | 102 |
to add an column with sequence to a table with existing rows, we need to set the new field values for each existing row, and we have to do so with mysql autoincrement feature. However, each mysql table can have at most 1 autoincrement column, thus we can't do the same for the 2nd and more sequence columns.
To fix it we have to execute more stmts to update such existing rows one by one. Let's do this later.
Issue migrated from trac ticket # 115
component: computing nodes | priority: major
2021-06-23 17:34:05: @jd-zhang created the issue