Skip to content

Commit 6cb459d

Browse files
committed
fixes #468
1 parent c23558f commit 6cb459d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ TOKEN : /* Operators */
300300

301301
TOKEN : /* Date/Time with time zones */
302302
{
303-
<DT_ZONE: <K_DATETIMELITERAL> <WHITESPACE> (<K_WITH> | <K_WITHOUT>) <WHITESPACE> "TIME" <WHITESPACE> <K_ZONE>>
303+
<DT_ZONE: <K_DATETIMELITERAL> (<WHITESPACE>)* ("(" <S_LONG> ")")? (<WHITESPACE>)* (<K_WITH> | <K_WITHOUT>) (<WHITESPACE>)+ "TIME" (<WHITESPACE>)+ <K_ZONE>>
304304
}
305305

306306
TOKEN : /* Numeric Constants */

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,15 @@ public void testCreateUnitonIssue402() throws JSQLParserException {
255255
public void testCreateUnitonIssue402_2() throws JSQLParserException {
256256
assertSqlCanBeParsedAndDeparsed("CREATE TABLE temp.abc AS (SELECT sku FROM temp.a UNION SELECT sku FROM temp.b)");
257257
}
258+
259+
public void testTimestampWithTimezone() throws JSQLParserException {
260+
assertSqlCanBeParsedAndDeparsed("CREATE TABLE country_region (" +
261+
"regionid BIGINT NOT NULL CONSTRAINT pk_auth_region PRIMARY KEY, " +
262+
"region_name VARCHAR (100) NOT NULL, " +
263+
"creation_date TIMESTAMP (0) WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP (0) NOT NULL, " +
264+
"last_change_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP (0), " +
265+
"CONSTRAINT region_name_unique UNIQUE (region_name))");
266+
}
258267

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

0 commit comments

Comments
 (0)