Skip to content

Commit bc11309

Browse files
committed
fixes #1518
1 parent 0cc2a29 commit bc11309

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5093,7 +5093,7 @@ ColDataType ColDataType():
50935093
[LOOKAHEAD(2) "(" {tk2 =null;} ( ( ( tk=<S_LONG> [ LOOKAHEAD(2) (tk2=<K_BYTE> | tk2=<K_CHAR>) ] ) | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER> | tk=<K_CHAR> )
50945094
{ argumentsStringList.add(tk.image + (tk2!=null?" " + tk2.image:"")); } ["," {/*argumentsStringList.add(",");*/}] )* ")"]
50955095
[( "[" {tk=null;} [ tk=<S_LONG> ] { array.add(tk!=null?Integer.valueOf(tk.image):null); } "]" )+ { colDataType.setArrayData(array); } ]
5096-
[LOOKAHEAD(2) <K_CHARACTER> <K_SET> tk=<S_IDENTIFIER> { colDataType.setCharacterSet(tk.image); } ]
5096+
[LOOKAHEAD(2) <K_CHARACTER> <K_SET> (tk=<S_IDENTIFIER> | tk=<K_BINARY>) { colDataType.setCharacterSet(tk.image); } ]
50975097

50985098
{
50995099
if (argumentsStringList.size() > 0)
@@ -5273,6 +5273,8 @@ List<String> CreateParameter():
52735273
|
52745274
tk=<K_PARALLEL> { param.add(tk.image); }
52755275
|
5276+
tk=<K_BINARY> { param.add(tk.image); }
5277+
|
52765278
(<K_ARRAY_LITERAL> exp=ArrayConstructor(true)) { param.add(exp.toString()); }
52775279
|
52785280
tk="::" colDataType = ColDataType() { param.add(tk.image); param.add(colDataType.toString()); }

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,4 +857,9 @@ public void testCreateUnionIssue1309() throws JSQLParserException {
857857
assertSqlCanBeParsedAndDeparsed(
858858
"CREATE TABLE temp.abc AS (SELECT c FROM t1) UNION (SELECT c FROM t2)");
859859
}
860+
861+
@Test
862+
public void testCreateTableBinaryIssue1518() throws JSQLParserException {
863+
assertSqlCanBeParsedAndDeparsed("CREATE TABLE `s` (`a` enum ('a', 'b', 'c') CHARACTER SET binary COLLATE binary)");
864+
}
860865
}

0 commit comments

Comments
 (0)