[#6485] Fixed aliasing syntax in MERGE
This commit is contained in:
parent
4a209aa4ce
commit
c20dc27254
@ -238,8 +238,8 @@ setClause = fieldName '=' field
|
||||
deleteStatement = 'DELETE' [ 'FROM' ] tableName [ 'WHERE' condition ] [ 'RETURNING' ( '*' | fields ) ]
|
||||
;
|
||||
|
||||
mergeStatement = 'MERGE INTO' tableName
|
||||
'USING' '(' select ')' [ 'AS' identifier ]
|
||||
mergeStatement = 'MERGE INTO' tableName [ [ 'AS' ] identifier ]
|
||||
'USING' '(' select ')' [ [ 'AS' ] identifier ]
|
||||
'ON' condition break
|
||||
{
|
||||
'WHEN MATCHED THEN UPDATE' 'SET' setClauses
|
||||
|
||||
@ -1198,13 +1198,19 @@ final class ParserImpl implements Parser {
|
||||
private static final Merge<?> parseMerge(ParserContext ctx) {
|
||||
parseKeyword(ctx, "MERGE INTO");
|
||||
Table<?> target = parseTableName(ctx);
|
||||
|
||||
if (parseKeywordIf(ctx, "AS") || !peekKeyword(ctx, "USING"))
|
||||
target = target.as(parseIdentifier(ctx));
|
||||
|
||||
parseKeyword(ctx, "USING");
|
||||
parse(ctx, '(');
|
||||
Select<?> using = parseSelect(ctx);
|
||||
TableLike<?> usingTable = using;
|
||||
parse(ctx, ')');
|
||||
if (parseKeywordIf(ctx, "AS"))
|
||||
|
||||
if (parseKeywordIf(ctx, "AS") || !peekKeyword(ctx, "ON"))
|
||||
usingTable = DSL.table(using).as(parseIdentifier(ctx));
|
||||
|
||||
parseKeyword(ctx, "ON");
|
||||
Condition on = parseCondition(ctx);
|
||||
boolean update = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user