[#8503] Make SET clause in ON DUPLICATE KEY UPDATE optional in parser

jOOQ parses a synthetic SET clause which is not supported by MySQL. This clause must be parsed optionally
This commit is contained in:
lukaseder 2019-04-10 12:01:55 +02:00
parent 3f84ccf58f
commit 929529ec7a
2 changed files with 4 additions and 2 deletions

View File

@ -317,7 +317,7 @@ insertStatement =
)
break
[
'ON DUPLICATE KEY UPDATE' 'SET' setClauses [ 'WHERE' condition ]
'ON DUPLICATE KEY UPDATE' [ 'SET' ] setClauses [ 'WHERE' condition ]
| 'ON DUPLICATE KEY IGNORE'
| 'ON CONFLICT' ( 'ON CONSTRAINT' constraintName | '(' fieldNames ')' ) 'DO'
(

View File

@ -1699,7 +1699,9 @@ final class ParserImpl implements Parser {
throw ctx.expected("DEFAULT VALUES", "SELECT", "SET", "VALUES");
if (parseKeywordIf(ctx, "ON")) {
if (parseKeywordIf(ctx, "DUPLICATE KEY UPDATE SET")) {
if (parseKeywordIf(ctx, "DUPLICATE KEY UPDATE")) {
parseKeywordIf(ctx, "SET");
InsertOnConflictWhereStep<?> where = onDuplicate.onDuplicateKeyUpdate().set(parseSetClauseList(ctx));
if (parseKeywordIf(ctx, "WHERE"))