assignments with ':=' when the variable has only been declared

This commit is contained in:
Christian De la Hoz 2021-08-31 20:33:28 +02:00
parent 117d416300
commit f13c6b4712
2 changed files with 7 additions and 1 deletions

View file

@ -147,6 +147,7 @@ DO $$
BEGIN
SELECT 1;
foo.bar = lower(foo.baz);
foo.bar := lower(foo.baz);
RETURN 2;
END
$$;
@ -165,6 +166,11 @@ $$;
(function_call
(identifier)
(identifier)))
(assign_statement
(identifier)
(function_call
(identifier)
(identifier)))
(return_statement
(number)))
(dollar_quote))))

View file

@ -459,7 +459,7 @@ module.exports = grammar({
optional($.execute_using),
),
execute_using: $ => seq(kw("using"), commaSep1($._value_expression)),
assign_statement: $ => seq($.identifier, "=", $._value_expression),
assign_statement: $ => seq($.identifier, choice("=", ":="), $._value_expression),
return_statement: $ => seq(kw("return"), choice(
seq(kw("query"), $.select_statement),
seq(kw("query"), $.execute_statement),