Comments (10)
CREATE TABLE t1
而不是 CREATE TABLE "t1"
吧?
@iamxy
from docs-cn.
这是日志里的信息,建表语句就是用的范例
from docs-cn.
@soniazhai 你是完全 copy 样例 来创建表的吗? 能不能提供一下你的所用的数据库以及版本,以及相关表的类似 show create table t1
的输出结果
from docs-cn.
@GregoryIan 是完全copy的,数据库是mysql ,版本Server version: 5.6.34
mysql> show create table t1;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| t1 | CREATE TABLE "t1" (
"id" int(11) NOT NULL DEFAULT '0',
"age" int(11) DEFAULT NULL,
PRIMARY KEY ("id")
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------+
mysql> show create table t2;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| t2 | CREATE TABLE "t2" (
"id" int(11) NOT NULL DEFAULT '0',
"name" varchar(256) DEFAULT NULL,
PRIMARY KEY ("id")
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
创建时的执行记录如下:
mysql> USE test;
Database changed
mysql> CREATE TABLE t1 (id INT, age INT, PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE t2 (id INT, name VARCHAR(256), PRIMARY KEY(id)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t2 VALUES (1, "a"), (2, "b"), (3, "c");Query OK, 0 rows affected (0.32 sec)
mysql> CREATE TABLE t2 (id INT, name VARCHAR(256), PRIMARY KEY(id)) ENGINE=InnoDB;
Query OK, 0 rows affected (0.44 sec)
mysql>
mysql> INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
Query OK, 3 rows affected (0.06 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> INSERT INTO t2 VALUES (1, "a"), (2, "b"), (3, "c");
ERROR 1054 (42S22): Unknown column 'a' in 'field list'
mysql> INSERT INTO t2 VALUES (1, 'a'), (2, 'b'), (3, 'c');
Query OK, 3 rows affected (0.05 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from t1;
+----+------+
| id | age |
+----+------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
+----+------+
3 rows in set (0.00 sec)
mysql> select * from t2;
+----+------+
| id | name |
+----+------+
| 1 | a |
| 2 | b |
| 3 | c |
+----+------+
3 rows in set (0.00 sec)
from docs-cn.
@soniazhai 你可以查看一下 SHOW VARIABLES LIKE '%sql_mode%';
是否是 ANSI_QUOTES
;TiDB 不支持用双引号当作 identifier quote character.
from docs-cn.
mysql> SHOW VARIABLES LIKE '%sql_mode%';
+---------------+------------------------------------------------------------------------+
| Variable_name | Value |
+---------------+------------------------------------------------------------------------+
| sql_mode | PIPES_AS_CONCAT,ANSI_QUOTES,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+---------------+------------------------------------------------------------------------+
1 row in set (0.00 sec)
from docs-cn.
@GregoryIan 在上面范例执行时,插入数据也报过错,就是双引号的问题。
from docs-cn.
@GregoryIan确实改了变量后,check通过了,thanks!
from docs-cn.
TiDB 不支持用双引号当作 identifier quote character.
更正,TiDB这边是支持的,可以设置 ANSI_QUOTES
变量来实现。
from docs-cn.
@tiancaiamao 我之前是设置ANSI_QUOTES了的,但执行check报错,现在把ANSI_QUOTES去掉执行check成功了
from docs-cn.
Related Issues (20)
- 建议补充 tikv-cdc 的相关内容
- tiup-component-cluster-template 文档待更新 HOT 1
- tiup-component-management 文档待更新 HOT 1
- 生成所有分区表的更新统计信息的SQL是否有误? HOT 1
- TiDB 版本号格式的问题 HOT 1
- 开头疑似乱码 HOT 2
- 6.5 tikv_gc_can_not_work 指标缺失 HOT 2
- tiup拓扑配置例子中tikv_servers中一个节点上配置双实例有误
- 多处出现错别字。“登陆”应改为“登录”,请全局搜索并修改。 HOT 1
- 文档勘误
- index复数表示错误
- 文档中自相矛盾 HOT 3
- 笔误
- 存储成本太高怎么解释?
- Include `systemd-timesyncd` into the list of NTP services
- UOS V20
- typo: tidb-lightning-physical-import-mode-usage HOT 2
- Blog Bug HOT 1
- Remove unsupport FLOAT4/FLOAT8 HOT 2
- The system table is incomplete.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs-cn.