cobar icon indicating copy to clipboard operation
cobar copied to clipboard

SQLParserDelegate不能解析DDL语句中的FOREIGN KEY

Open long187 opened this issue 7 years ago • 0 comments

CREATE TABLE IF NOT EXISTS `test_table_normal`(  
scoreID INTEGER NOT NULL PRIMARY KEY,  
stuID     INTEGER NOT NULL,  
KEMUID     INTEGER NOT NULL,  
score     FLOAT,  
FOREIGN KEY SCORE_ID_FK (stuID) REFERENCES students (stuid),  
CONSTRAINT CHK_SCORE_ZIP CHECK (SCORE > 0)  
);  
ALTER TABLE test_table_normal
ADD FOREIGN KEY (stuID)
REFERENCES Persons(stuID);

报错:

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; Error occurs around this fragment: {FLOAT,  
FOREIGN KEY SCORE}. Error cause: unsupportted column definition
	at com.alibaba.cobar.parser.recognizer.SQLParserDelegate.parse(SQLParserDelegate.java:155)
	at com.alibaba.cobar.parser.recognizer.SQLParserDelegate.parse(SQLParserDelegate.java:160)
	at com.alibaba.cobar.parser.recognizer.SQLParserDelegate.parse(SQLParserDelegate.java:164)
	at com.alibaba.cobar.parser.recognizer.SQLParserDelegateTest.testCreateAndDropTable(SQLParserDelegateTest.java:157)

long187 avatar Oct 26 '17 07:10 long187