Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

sql_mode 为ANSI格式时,无法parse create table 语句 #1310

Closed
ChinaXing opened this issue Jun 27, 2016 · 1 comment
Closed

sql_mode 为ANSI格式时,无法parse create table 语句 #1310

ChinaXing opened this issue Jun 27, 2016 · 1 comment
Milestone

Comments

@ChinaXing
Copy link

当设置set sql_mode = 'ANSI'. 时, show create table 返回的语句中,列和表名会用双引号包含。这是ANSI 标准SQL模式。

如下,而这种语句Druid的parser 会报错。无法解析。

CREATE TABLE "MessageInstance" (
  "id" int(11) NOT NULL AUTO_INCREMENT,
  "clusterId" int(11) NOT NULL,
  "messageId" int(11) NOT NULL,
  "ipv4" varchar(10) DEFAULT NULL,
  "masterIpv4" varchar(10) DEFAULT NULL,
  "port" int(4) DEFAULT NULL,
  "managerPort" int(4) DEFAULT NULL,
  "online" tinyint(4) DEFAULT NULL,
  "status" tinyint(4) DEFAULT NULL,
  "info" varchar(100) DEFAULT NULL,
  "role" tinyint(4) DEFAULT NULL,
  "created" datetime DEFAULT NULL,
  "updated" datetime DEFAULT NULL,
  PRIMARY KEY ("id"),
  KEY "ix_messageId" ("messageId")
)

错误:

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :' KEY "ix_messageId" ("messageId")
)',expect LPAREN, actual LITERAL_ALIAS ix_messageId

能否给予支持解析?

wenshao added a commit to wenshao/druid that referenced this issue Jun 29, 2016
@wenshao wenshao added this to the 1.0.21 milestone Jun 29, 2016
@wenshao
Copy link
Member

wenshao commented Jun 29, 2016

已支持,请等待1.0.21版本

@wenshao wenshao closed this as completed Jun 29, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants