tree-sitter-plpgsql/corpus/create_function/general.txt
Christian De la Hoz 6303f6c3d8 getting into shape
2021-08-28 12:46:32 +02:00

125 lines
3.8 KiB
Text

================================================================================
body block
================================================================================
CREATE FUNCTION FOO () RETURNS void AS $$ BEGIN END $$ LANGUAGE sql;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(block
(dollar_quote)
(body)
(dollar_quote))
(identifier)))
================================================================================
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)))
================================================================================
immutable
================================================================================
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql IMMUTABLE;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(string)
(identifier)
(function_volatility)))
================================================================================
stable
================================================================================
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql STABLE;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(string)
(identifier)
(function_volatility)))
================================================================================
volatile
================================================================================
CREATE FUNCTION FOO () RETURNS void AS 'select' LANGUAGE sql VOLATILE;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(function_return
(identifier))
(string)
(identifier)
(function_volatility)))
================================================================================
returns setof
================================================================================
CREATE FUNCTION FOO () RETURNS SETOF text AS 'select' LANGUAGE sql;
--------------------------------------------------------------------------------
(source_file
(create_function_statement
(function_signature
(identifier)
(function_parameters))
(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)))