Skip to content

[BUG] JSQLParser 4.7-SNAPSHOT(+4.6) PostgreSQL(+others) Enum error on ReferentialAction.Type.valueOf() when delete/update keyword is lowercase #1779

Closed
@daredevil2033

Description

@daredevil2033

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions