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

View file

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