码迷,mamicode.com
首页 > 其他好文 > 详细

MGR 需要使用主键

时间:2020-01-14 11:37:48      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:rds   error   nal   require   ima   primary   values   record   erro   

验证MGR架构表需要使用主键,不然插入数据会报错。

mysql> show tables;
+--------------+
| Tables_in_dd |
+--------------+
| a            |
+--------------+
1 row in set (0.00 sec)

mysql> desc a;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql> insert into a values(1);
ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin.

mysql> alter table a add primary key (id);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> desc a;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | NO   | PRI | NULL    |       |
+-------+---------+------+-----+---------+-------+
1 row in set (0.01 sec)

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

mysql> select * from a;
+----+
| id |
+----+
|  1 |
+----+
1 row in set (0.00 sec)

MGR 需要使用主键

标签:rds   error   nal   require   ima   primary   values   record   erro   

原文地址:https://blog.51cto.com/roidba/2466536

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!