MGR 需要使用主键

发布时间:2020-03-02 18:15:29 作者:roidba
来源:网络 阅读:367

验证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)
推荐阅读:
  1. 为什么MGR需要用主键
  2. 说MGR - 全局事务认证模块&异地事务执行模块

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mgr 表需要有主键 gr

上一篇:SQL Server查询优化和事务处理

下一篇:HTML5新特性---Form表单前台通过正则表达式自动验证

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》