weixin_39742392
weixin_39742392
2020-11-20 16:30

Fix CONSTRAINT syntax

Index Issue: pingcap/tidb#11486

These are bad (incompatible) SQL cases:

sql
ALTER TABLE t ADD ( CHECK ( expr ) )
ALTER TABLE t ADD ( CONSTRAINT CHECK ( expr ) )
ALTER TABLE t ADD COLUMN ( CONSTRAINT CHECK ( expr ) )
ALTER TABLE t ADD COLUMN ( CONSTRAINT CHECK ( expr ) ENFORCED , CHECK ( expr ) )
ALTER TABLE t ADD COLUMN RESOURCE DATE CONSTRAINT CHECK ( expr ) FIRST
ALTER TABLE ident ADD ( CONSTRAINT FOREIGN KEY ident ( EXECUTE ( 123 ) ) REFERENCES t ( a ) MATCH SIMPLE ON DELETE CASCADE ON UPDATE SET NULL )
ALTER TABLE t ADD COLUMN ( CONSTRAINT ident CHECK ( 1>2 ) NOT ENFORCED )
ALTER TABLE t ADD a TINYBLOB CONSTRAINT ident CHECK ( 1>2 ) REFERENCES b ON DELETE CASCADE ON UPDATE CASCADE

Claim this subtask based on the comments below this issue.

该提问来源于开源项目:pingcap/parser

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答