Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 1.24 KB

6.2_insert_sequence.md

File metadata and controls

31 lines (24 loc) · 1.24 KB

6.2 INSERT自增序列表由dble生成,不能显式指定自增列,MySQL可以。

具体表现如下:

MySQL行为:

desc mysql_autoinc;
+--------+------------+------+-----+---------+----------------+
| Field  | Type       | Null | Key | Default | Extra          |
+--------+------------+------+-----+---------+----------------+
| c_char | char(255)  | YES  |     | NULL    |                |
| id     | bigint(20) | NO   | PRI | NULL    | auto_increment |
+--------+------------+------+-----+---------+----------------+
2 rows in set (0.02 sec)

[test_yhq]>insert into mysql_autoinc values('1',1);
Query OK, 1 row affected (0.01 sec)

dble行为

desc sharding_four_node_autoinc;
+--------+------------+------+-----+---------+----------------+
| Field  | Type       | Null | Key | Default | Extra          |
+--------+------------+------+-----+---------+----------------+
| c_char | char(255)  | YES  |     | NULL    |                |
| id     | bigint(20) | NO   | PRI | NULL    | auto_increment |
+--------+------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)
[testdb]>insert into sharding_four_node_autoinc values('2',2);
ERROR 1064 (HY000): In insert Syntax, you can't set value for Autoincrement column!