[#7518] Support parsing CURTIME() and CURDATE()

This commit is contained in:
Lukas Eder 2018-08-22 10:31:14 +02:00
parent b122db34e5
commit eaccc7897b
2 changed files with 8 additions and 2 deletions

View File

@ -642,6 +642,8 @@ term =
| 'CURRENT_TIME'
| 'CURRENT_TIMESTAMP'
| 'CURRENT_USER'
| 'CURDATE' '(' ')'
| 'CURTIME' '(' ')'
| dateLiteral
| 'DATEADD' '(' datePart ',' field ',' field ')'
| 'DATE_TRUNC' '(' stringLiteral ',' field ')'

View File

@ -4494,12 +4494,16 @@ final class ParserImpl implements Parser {
return field;
if (D.is(type))
if (parseKeywordIf(ctx, "CURRENT_TIMESTAMP") && (parseIf(ctx, '(') && parse(ctx, ')') || true))
if (parseKeywordIf(ctx, "CURRENT_DATE") && (parseIf(ctx, '(') && parse(ctx, ')') || true))
return currentDate();
else if (parseKeywordIf(ctx, "CURRENT_TIMESTAMP") && (parseIf(ctx, '(') && parse(ctx, ')') || true))
return currentTimestamp();
else if (parseKeywordIf(ctx, "CURRENT_TIME") && (parseIf(ctx, '(') && parse(ctx, ')') || true))
return currentTime();
else if (parseKeywordIf(ctx, "CURRENT_DATE") && (parseIf(ctx, '(') && parse(ctx, ')') || true))
else if (parseFunctionNameIf(ctx, "CURDATE") && parse(ctx, '(') && parse(ctx, ')'))
return currentDate();
else if (parseFunctionNameIf(ctx, "CURTIME") && parse(ctx, '(') && parse(ctx, ')'))
return currentTime();
if ((field = parseFieldCaseIf(ctx)) != null)
return field;