diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 2faf0c61..d2726180 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -113,12 +113,17 @@ public static function parse(Parser $parser, TokensList $list, array $options = $commaLastSeenAt = $token; } } elseif ($state === 1) { + // Reserved keywords like ON are valid values in SET statements + // (e.g. SET @@sql_log_bin = ON). Try parsing as expression first, + // and if that fails, accept reserved keywords as literal values. $tmp = Expression::parse( $parser, $list, ['breakOnAlias' => true] ); - if ($tmp === null) { + if ($tmp === null && $token->type === Token::TYPE_KEYWORD && $token->value === 'ON') { + $tmp = new Expression($token->token); + } elseif ($tmp === null) { $parser->error('Missing expression.', $token); break; }