Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support timestamptz dateliteral #1621

Merged
merged 2 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public DateTimeLiteralExpression withType(DateTime type) {
}

public enum DateTime {
DATE, TIME, TIMESTAMP;
DATE, TIME, TIMESTAMP, TIMESTAMPTZ;
}
}
2 changes: 1 addition & 1 deletion src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
| <K_CYCLE:"CYCLE">
| <K_DATABASE:"DATABASE">
| <K_DECLARE: "DECLARE">
| <K_DATETIMELITERAL : ("DATE" | "TIME" | "TIMESTAMP") >
| <K_DATETIMELITERAL : ("DATE" | "TIME" | "TIMESTAMP" | "TIMESTAMPTZ") >
| <K_DATE_LITERAL : ( "YEAR" | "MONTH" | "DAY" | "HOUR" | "MINUTE" | "SECOND" ) >
| <K_DBA_RECYCLEBIN: "DBA_RECYCLEBIN">
| <K_DEFAULT : "DEFAULT">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5242,4 +5242,9 @@ public void testNamedWindowDefinitionIssue1581() throws JSQLParserException {
public void testNamedWindowDefinitionIssue1581_2() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT sum(salary) OVER w1, avg(salary) OVER w2 FROM empsalary WINDOW w1 AS (PARTITION BY depname ORDER BY salary DESC), w2 AS (PARTITION BY depname2 ORDER BY salary2)");
}

@Test
public void testTimestamptzDateTimeLiteral() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT * FROM table WHERE x >= TIMESTAMPTZ '2021-07-05 00:00:00+00'");
}
}