classOptionRule
final class OptionRule
Lowers routine options and ALTER FUNCTION, PROCEDURE and ROUTINE.
Rule: PG-ROUTINE-OPTION-LOWER-001. Scope: opt_createfunc_opt_list, createfunc_opt_list, createfunc_opt_item, common_func_opt_item, func_as, transform_type_list, AlterFunctionStmt, alterfunc_opt_list, opt_restrict. Constructors: the routine options and AlterRoutine. EXTERNAL before SECURITY and the trailing RESTRICT of ALTER are noise words the server ignores. A configuration setting is lowered by the utility family. Termination: lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-createfunction.html, https://www.postgresql.org/docs/17/sql-alterfunction.html. Status: Implemented.
Methods§
public function options(Node $list): list<RoutineOption>Lowers opt_createfunc_opt_list; no option is an empty list.
A definition (AS) is lowered last, with the language of the first LANGUAGE option, wherever it is written.
Parameters
$list | Node |
Returns
list<RoutineOption>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
- static-call ImplementationGap::production() line 95
- method-call Lowering::items() line 97
- method-call OptionRule::option() line 102
- new Name line 105
public function option(Node $item, ?Name $language = null): RoutineOptionLowers createfunc_opt_item; a definition is written in the given language.
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\OptionRule::options() packages/sql-semantics-postgres/src/Lowering/Routine/OptionRule.php:102
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\OptionRule::options() packages/sql-semantics-postgres/src/Lowering/Routine/OptionRule.php:108
Calls 7
- class-const OptionRule::ATTRIBUTES() line 122
- method-call OptionRule::definition() line 127
- new RoutineLanguage line 128
- new Transforms line 129
- method-call OptionRule::transforms() line 129
- method-call OptionRule::common() line 130
- static-call ImplementationGap::production() line 131
public function common(Node $item): RoutineOptionLowers common_func_opt_item.
Parameters
$item | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\OptionRule::option() packages/sql-semantics-postgres/src/Lowering/Routine/OptionRule.php:130
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\OptionRule::alter() packages/sql-semantics-postgres/src/Lowering/Routine/OptionRule.php:204
Calls 8
- class-const OptionRule::ATTRIBUTES() line 143
- new RoutineEstimate line 148
- class-const EstimateKind::Cost() line 148
- class-const EstimateKind::Rows() line 149
- new SupportFunction line 150
- new ConfigurationSetting line 151
- new ParallelSafety line 152
- static-call ImplementationGap::production() line 153
public function definition(Node $definition, ?Name $language): RoutineDefinitionLowers func_as: the definition in the routine's language, null when none is written.
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 3
- new RoutineDefinition line 168
- new RoutineSource line 168
- static-call ImplementationGap::production() line 170
Lowers transform_type_list.
Parameters
$list | Node |
Returns
list<TypeName>Test cases 1
Called from 1
Calls 1
- method-call Lowering::items() line 182
public function alter(Node $statement): AlterRoutineLowers AlterFunctionStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 7
- class-const OptionRule::ALTERED() line 197
- static-call ImplementationGap::production() line 197
- method-call Lowering::items() line 203
- method-call OptionRule::common() line 204
- new AlterRoutine line 207
- method-call SignatureRule::function() line 207
- new SignatureRule line 207
Private surface 3§
Implementation details, listed for orientation only.
private const ATTRIBUTES = ['common_func_opt_item: CALLED ON NULL_P INPUT_P' => \SqlSemantics\Platform\Pos…private const ALTERED = ['AlterFunctionStmt: ALTER FUNCTION function_with_argtypes alterfunc_opt_list o…private Lowering $loweringTest cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
OptionRuleTest::testAlterLowersTheKindcallsOptionRuleTest::testCommonLowersExternalSecurityAsSecuritycallsOptionRuleTest::testDefinitionLowersALinkSymbolcallsOptionRuleTest::testOptionLowersWindowAndLanguagecallsOptionRuleTest::testOptionsLowersAnEmptyListcallsOptionRuleTest::testTransformsLowersEachTypecalls
Relations§
Instantiated in 2
Method calls 5
- 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
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\Routines::statement() packages/sql-semantics-postgres/src/Lowering/Routine/Routines.php:47