[#7171] Support parsing VALUES wherever a query primary can be used

This commit is contained in:
lukaseder 2018-03-09 16:53:28 +01:00
parent 47e045d4c4
commit 9422fbc5a2
2 changed files with 6 additions and 2 deletions

View File

@ -192,7 +192,7 @@ revokeStatement = 'REVOKE'
'FROM' ( userName | roleName | 'PUBLIC')
;
selectStatement = select | values [ correlationName ]
selectStatement = select
;
insertStatement = [ with ] 'INSERT INTO' tableName
@ -305,6 +305,7 @@ select =
[ orderBy ]
[ offsetFetch ]
[ forUpdate ]
| values
;
queryExpressionBody =

View File

@ -669,7 +669,7 @@ final class ParserImpl implements Parser {
case 'v':
case 'V':
if (!parseSelect && peekKeyword(ctx, "VALUES"))
return ctx.dsl.selectFrom(parseTableValueConstructor(ctx));
return parseSelect(ctx);
case 'w':
case 'W':
@ -911,6 +911,9 @@ final class ParserImpl implements Parser {
return result;
}
if (peekKeyword(ctx, "VALUES"))
return (SelectQueryImpl<Record>) ctx.dsl.selectQuery(parseTableValueConstructor(ctx));
parseKeyword(ctx, "SELECT");
String hints = parseHints(ctx);
boolean distinct = parseKeywordIf(ctx, "DISTINCT") || parseKeywordIf(ctx, "UNIQUE");