classFunctionRule
final class FunctionRule
Lowers CREATE FUNCTION and CREATE PROCEDURE with their parameters, results and bodies.
Rule: PG-FUNCTION-LOWER-001. Scope: CreateFunctionStmt, func_args_with_defaults, func_args_with_defaults_list, func_arg_with_default, func_return, table_func_column, table_func_column_list, opt_routine_body, ReturnStmt, routine_body_stmt_list, routine_body_stmt. Constructors: CreateFunction, RoutineParameters, ResultTable, ResultColumn, ReturnStatement, AtomicBody. The statements of a BEGIN ATOMIC block are lowered by their own families; an empty statement between semicolons is discarded, as the server does. Termination: lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-createfunction.html, https://www.postgresql.org/docs/17/sql-createprocedure.html. Status: Implemented.
Methods§
public function create(Node $statement): CreateFunctionLowers CreateFunctionStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 8
- method-call FunctionRule::parameters() line 57
- new OptionRule line 58
- new CreateFunction line 61
- method-call FunctionRule::result() line 61
- method-call OptionRule::options() line 61
- method-call FunctionRule::body() line 61
- method-call FunctionRule::table() line 62
- static-call ImplementationGap::production() line 65
public function parameters(Node $parameters): RoutineParametersLowers func_args_with_defaults.
Parameters
$parameters | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- new RoutineParameters line 78
- static-call ImplementationGap::production() line 81
- method-call Lowering::items() line 84
- method-call FunctionRule::parameter() line 85
public function parameter(Node $parameter): FunctionParameterLowers func_arg_with_default.
Parameters
$parameter | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 5
- new SignatureRule line 99
- method-call SignatureRule::parameter() line 102
- class-const DefaultSpelling::Keyword() line 103
- class-const DefaultSpelling::EqualsSign() line 104
- static-call ImplementationGap::production() line 105
Lowers func_return.
Parameters
$result | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 1
- static-call ImplementationGap::production() line 118
public function table(Node $list): ResultTableLowers table_func_column_list.
Parameters
$list | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- method-call Lowering::items() line 132
- static-call ImplementationGap::production() line 135
- new ResultColumn line 137
- new ResultTable line 140
public function body(Node $body): ReturnStatement|AtomicBody|nullLowers opt_routine_body; no body is null.
Parameters
$body | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\FunctionRule::create() packages/sql-semantics-postgres/src/Lowering/Routine/FunctionRule.php:61
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\FunctionRule::create() packages/sql-semantics-postgres/src/Lowering/Routine/FunctionRule.php:62
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\FunctionRule::create() packages/sql-semantics-postgres/src/Lowering/Routine/FunctionRule.php:63
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\FunctionRule::create() packages/sql-semantics-postgres/src/Lowering/Routine/FunctionRule.php:64
Calls 4
- method-call FunctionRule::return() line 154
- new AtomicBody line 155
- method-call FunctionRule::statements() line 155
- static-call ImplementationGap::production() line 156
public function return(Node $statement): ReturnStatementLowers ReturnStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\FunctionRule::body() packages/sql-semantics-postgres/src/Lowering/Routine/FunctionRule.php:154
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\FunctionRule::statements() packages/sql-semantics-postgres/src/Lowering/Routine/FunctionRule.php:189
Calls 2
- static-call ImplementationGap::production() line 169
- new ReturnStatement line 172
public function statements(Node $list): list<Statement|ReturnStatement>Lowers routine_body_stmt_list, dropping empty statements.
Parameters
$list | Node |
Returns
list<Statement|ReturnStatement>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- method-call Lowering::items() line 185
- method-call Lowering::optional() line 188
- method-call FunctionRule::return() line 189
- static-call ImplementationGap::production() line 190
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
FunctionRuleTest::testBodyLowersNoBodycallsFunctionRuleTest::testCreateLowersEachFormcallsFunctionRuleTest::testParameterLowersBothDefaultSpellingscallsFunctionRuleTest::testParametersLowersAnEmptyListcallsFunctionRuleTest::testResultLowersSetofcallsFunctionRuleTest::testReturnLowersTheExpressioncallsFunctionRuleTest::testStatementsDropsEmptyStatementscallsFunctionRuleTest::testTableLowersTheColumnscalls