Closed
Description
Failing SQL Feature:
Parsing CreateTable statement fails if the "delete/update" keyword in outline foreign key constraint is lowercase.
Technically not supported but in practice everything except this works in either case.
SQL Example:
CREATE TABLE DATABASES
(
NAME VARCHAR(50) NOT NULL,
OWNER VARCHAR(50) NOT NULL,
PRIMARY KEY (NAME),
FOREIGN KEY(OWNER) REFERENCES USERS (USERNAME) ON delete CASCADE
);
Software Information:
- JSqlParser version 4.6 and 4.7-SNAPSHOT
- Database PostgreSQL (and probably most others)
Problem
CCJSqlParser.java lines 17281, 17302, 20970, 20991 in 4.7-SNAPSHOT:
fkIndex.setReferentialAction(ReferentialAction.Type.valueOf(tk.image), action);
Lines 20900 and 20921 are affected as well:
alterExp.setReferentialAction(ReferentialAction.Type.valueOf(tk.image), action);
Solution
changing tk.image to tk.image.toUpperCase() should work