classCallRule
final class CallRule
Lowers function calls written with the function's name, and their arguments and aggregate clauses.
Rule: PG-CALL-LOWERING-001. Scope: func_expr, func_expr_windowless, func_application, func_arg_list, func_arg_expr, func_arg_list_opt, within_group_clause, filter_clause. Constructor: FunctionCall, PositionalArgument, NamedArgument; the SQL-syntax functions and the JSON aggregates go to their rules. ALL before the arguments builds the same node as no quantifier (noise, see InvocationNoise). The grammar rejects WITHIN GROUP together with an ordering inside the parentheses, DISTINCT or VARIADIC: such SQL is outside the language and raises an AnalysisException with the server's message. Termination: argument lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-EXPRESSIONS-FUNCTION-CALLS, https://www.postgresql.org/docs/17/sql-expressions.html#SYNTAX-AGGREGATES. Status: Implemented.
Methods§
Lowers func_expr, func_expr_windowless or func_application.
Parameters
$call | Node |
Returns
Throws
AnalysisException When WITHIN GROUP is combined with an ordering, DISTINCT or VARIADICImplementationGap When the production has no ruleTest cases 4
Called from 1
Calls 4
- method-call CallRule::windowed() line 57
- method-call JsonRule::aggregate() line 58
- new JsonRule line 58
- method-call CallRule::application() line 64
public function application(
Node $application,
list<SortItem> $withinGroup = [],
?Scalar $filter = null,
Node|null $over = null,
): FunctionCallLowers func_application with the clauses that may follow it.
Parameters
Returns
Throws
AnalysisException When WITHIN GROUP is combined with an ordering, DISTINCT or VARIADIC, which the action of `func_expr: func_application within_group_clause filter_clause over_clause` in `gram.y` rejectsImplementationGap When the production has no ruleTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::call() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:64
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::call() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:66
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::windowed() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:121
Calls 6
- method-call CallRule::arguments() line 86
- method-call CallRule::order() line 86
- method-call CallRule::argument() line 89
- static-call ImplementationGap::production() line 93
- new AnalysisException line 104
- new FunctionCall line 109
public function windowed(Form $form): FunctionCallLowers func_expr: func_application within_group_clause filter_clause over_clause.
Parameters
$form | Form |
Returns
Throws
AnalysisException When WITHIN GROUP is combined with an ordering, DISTINCT or VARIADICCalled from 1
Calls 3
- method-call CallRule::withinGroup() line 119
- method-call Form::node() line 119
- method-call CallRule::application() line 121
Lowers within_group_clause; no clause is an empty ordering.
Parameters
$clause | Node |
Returns
list<SortItem>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call CallRule::order() line 137
- static-call ImplementationGap::production() line 138
Lowers filter_clause; no clause is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 1
- static-call ImplementationGap::production() line 154
Lowers func_arg_list or func_arg_list_opt; no argument is an empty list.
Parameters
$list | Node |
Returns
list<Argument>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 6
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:86
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:87
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:88
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:91
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::arguments() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:172
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::arguments() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:73
Calls 4
- method-call CallRule::arguments() line 172
- static-call ImplementationGap::production() line 173
- method-call Lowering::items() line 177
- method-call CallRule::argument() line 178
Lowers func_arg_expr.
Parameters
$argument | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:89
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:91
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::arguments() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:178
Calls 5
- new PositionalArgument line 194
- new NamedArgument line 195
- class-const ArgumentSpelling::Assignment() line 195
- class-const ArgumentSpelling::Arrow() line 196
- static-call ImplementationGap::production() line 197
Lowers an ordering: opt_sort_clause, sort_clause or sortby_list.
Parameters
$clause | Node |
Returns
list<SortItem>Test cases 1
Called from 6
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:86
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:87
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:88
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:89
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::application() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:91
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\CallRule::withinGroup() packages/sql-semantics-postgres/src/Lowering/Invocation/CallRule.php:137
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
CallRuleTest::testApplicationLowersTheNameAndArgumentscallsCallRuleTest::testApplicationRejectsDistinctWithinGroupcallsCallRuleTest::testArgumentLowersTheAssignmentSpellingcallsCallRuleTest::testArgumentsLowersAnEmptyOptionalListcallsCallRuleTest::testCallLowersAWindowlessCallcallsCallRuleTest::testCallLowersEveryCallFormcallsCallRuleTest::testFilterLowersNoClauseToNullcallsCallRuleTest::testOrderLowersNoOrderingcallsCallRuleTest::testWindowedLowersWithinGroupcallsCallRuleTest::testWithinGroupLowersNoClauseToNoOrderingcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::call() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:61
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::arguments() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:73
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::filter() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:113
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::call() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:61
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::arguments() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:73
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::filter() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:113