tree-sitter-plpgsql/corpus/create_function/general.txt

160 lines
4.9 KiB
Text
Raw Normal View History

2021-08-21 20:15:42 +03:00
================================================================================
2021-08-28 13:46:32 +03:00
body block
2021-08-21 20:15:42 +03:00
================================================================================
2021-08-28 13:46:32 +03:00
CREATE FUNCTION FOO () RETURNS void AS $$ BEGIN END $$ LANGUAGE sql;
2021-08-21 20:15:42 +03:00
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
2021-08-28 13:46:32 +03:00
(function_return
(identifier))
2021-08-21 20:15:42 +03:00
(block
(dollar_quote)
2021-08-28 13:46:32 +03:00
(body)
2021-08-21 20:15:42 +03:00
(dollar_quote))
(identifier)))
2021-08-28 13:46:32 +03:00
================================================================================
or replace
================================================================================
CREATE OR REPLACE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(or_replace)
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(string)
(identifier)))
2021-08-21 20:15:42 +03:00
================================================================================
immutable
================================================================================
2021-08-28 13:46:32 +03:00
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql IMMUTABLE;
2021-08-21 20:15:42 +03:00
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
2021-08-28 13:46:32 +03:00
(function_return
(identifier))
(string)
2021-08-21 20:15:42 +03:00
(identifier)
(function_volatility)))
================================================================================
stable
================================================================================
2021-08-28 13:46:32 +03:00
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql STABLE;
2021-08-21 20:15:42 +03:00
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
2021-08-28 13:46:32 +03:00
(function_return
(identifier))
(string)
2021-08-21 20:15:42 +03:00
(identifier)
(function_volatility)))
================================================================================
volatile
================================================================================
2021-08-28 13:46:32 +03:00
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql VOLATILE;
2021-08-21 20:15:42 +03:00
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
2021-08-28 13:46:32 +03:00
(function_return
(identifier))
(string)
2021-08-21 20:15:42 +03:00
(identifier)
(function_volatility)))
================================================================================
2021-08-28 13:46:32 +03:00
returns setof
2021-08-21 20:15:42 +03:00
================================================================================
2021-08-28 13:46:32 +03:00
CREATE FUNCTION FOO () RETURNS SETOF text AS 'select' LANGUAGE sql;
2021-08-21 20:15:42 +03:00
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
2021-08-28 13:46:32 +03:00
(function_return
(return_setof
(identifier)))
(string)
(identifier)))
================================================================================
returns table
================================================================================
CREATE FUNCTION FOO () RETURNS TABLE(a text, b bigint) AS 'select' LANGUAGE sql;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(return_table
(var_declaration
(identifier)
(identifier))
(var_declaration
(identifier)
(identifier))))
(string)
(identifier)))
2021-09-01 18:48:14 +03:00
================================================================================
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)))