security definer

This commit is contained in:
Christian De la Hoz 2021-09-01 17:48:14 +02:00
parent fa4317ba96
commit d6a6775598
2 changed files with 41 additions and 1 deletions

View file

@ -123,3 +123,37 @@ CREATE FUNCTION FOO () RETURNS TABLE(a text, b bigint) AS 'select' LANGUAGE sql;
(identifier)))) (identifier))))
(string) (string)
(identifier))) (identifier)))
================================================================================
security definer
================================================================================
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql SECURITY definer;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(string)
(identifier)
(function_run_as)))
================================================================================
security invoker
================================================================================
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql SECURITY INVOKER;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(string)
(identifier)
(function_run_as)))

View file

@ -582,7 +582,13 @@ module.exports = grammar({
$.string, $.string,
), ),
kw("language"), choice($.identifier, $.string), kw("language"), choice($.identifier, $.string),
optional($.function_volatility) optional($.function_volatility),
optional($.function_run_as),
),
function_run_as: $ => seq(
kw("security"),
choice(kw("invoker"), kw("definer"))
), ),
function_return: $ => seq( function_return: $ => seq(