Skip to content

Commit 24f232c

Browse files
committed
fixed #491
1 parent 71692c5 commit 24f232c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,8 +3105,8 @@ List<String> CreateParameter():
31053105
}
31063106
{
31073107
(
3108-
((tk=<S_IDENTIFIER> { identifier.append(tk.image); }
3109-
["." tk2=<S_IDENTIFIER> { identifier.append("."); identifier.append(tk2.image); }])
3108+
(((tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { identifier.append(tk.image); }
3109+
["." (tk2=<S_IDENTIFIER> | tk2=<S_QUOTED_IDENTIFIER>) { identifier.append("."); identifier.append(tk2.image); }])
31103110
{ param.add(identifier.toString()); })
31113111
|
31123112
tk=<K_NULL> { param.add(tk.image); }
@@ -3178,7 +3178,7 @@ String AList():
31783178
{
31793179
"("
31803180

3181-
( (tk=<S_LONG> | tk=<S_DOUBLE> | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER>) { retval.append(tk.image); }
3181+
( (tk=<S_LONG> | tk=<S_DOUBLE> | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER> | tk=<S_QUOTED_IDENTIFIER>) { retval.append(tk.image); }
31823182
[("," {retval.append(",");} | "=" {retval.append("=");})] )*
31833183

31843184
")"

src/test/java/net/sf/jsqlparser/test/create/CreateTableTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,14 @@ public void testTimestampWithTimezone() throws JSQLParserException {
268268
public void testCreateTableAsSelect3() throws JSQLParserException {
269269
assertSqlCanBeParsedAndDeparsed("CREATE TABLE public.sales1 AS (SELECT * FROM public.sales)");
270270
}
271+
272+
public void testQuotedPKColumnsIssue491() throws JSQLParserException {
273+
assertSqlCanBeParsedAndDeparsed("CREATE TABLE `FOO` (`ID` INT64, `NAME` STRING (100)) PRIMARY KEY (`ID`)");
274+
}
275+
276+
public void testQuotedPKColumnsIssue491_2() throws JSQLParserException {
277+
assertSqlCanBeParsedAndDeparsed("CREATE TABLE `FOO` (`ID` INT64, `NAME` STRING (100), PRIMARY KEY (`ID`))");
278+
}
271279

272280
public void testRUBiSCreateList() throws Exception {
273281
BufferedReader in = new BufferedReader(new InputStreamReader(CreateTableTest.class.

0 commit comments

Comments
 (0)