classExpressions
final class Expressions
The entry point of the expression family.
Rule: PG-EXPRESSION-001. Scope: a_expr, b_expr, c_expr, columnref, indirection, indirection_el, opt_indirection, opt_slice_bound, row, explicit_row, implicit_row, sub_type, subquery_Op, expr_list, array_expr, array_expr_list, in_expr, case_expr, when_clause_list, when_clause, case_default, case_arg, json_predicate_type_constraint and opt_asymmetric, through PG-EXPRESSION-OPERATOR-001, PG-EXPRESSION-PREDICATE-001, PG-EXPRESSION-PRIMARY-001 and PG-EXPRESSION-CONSTRUCTOR-001. A b_expr is lowered into the same structures as an a_expr; the structures accept only the operands the position allows (PG-PRECEDENCE-001). Function calls are lowered by the invocation family and queries by the query family. Termination: lists are flattened iteratively; operand nesting recurses on the depth of the tree. Source: https://www.postgresql.org/docs/17/sql-expressions.html. Status: Implemented.
Methods§
Lowers a scalar expression: a_expr, b_expr or c_expr.
Parameters
$expression | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Expression\Expressions::expression() packages/sql-semantics-postgres/src/Lowering/Expression/Expressions.php:59
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Expression\Expressions::expressions() packages/sql-semantics-postgres/src/Lowering/Expression/Expressions.php:78
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Expression\Expressions::comparison() packages/sql-semantics-postgres/src/Lowering/Expression/Expressions.php:113
Calls 8
- method-call Expressions::expression() line 59
- method-call OperatorRule::lower() line 63
- new OperatorRule line 63
- method-call PredicateRule::lower() line 63
- new PredicateRule line 63
- static-call ImplementationGap::production() line 63
- method-call PrimaryRule::lower() line 64
- new PrimaryRule line 64
public function expressions(Node $list): list<Scalar>Lowers an expression list: expr_list.
Parameters
$list | Node |
Returns
list<Scalar>Calls 2
- method-call Lowering::items() line 77
- method-call Expressions::expression() line 78
Lowers a column reference: columnref.
A dotted name is a ColumnReference; one ending in .* is a ColumnStar; a subscript after the dotted name makes an Indirection of it.
Parameters
$reference | Node |
Returns
Calls 2
- method-call PrimaryRule::columnReference() line 93
- new PrimaryRule line 93
public function indirection(Node $indirection): list<IndirectionStep>Lowers the steps applied to a value or an assignment target: indirection or opt_indirection; no step is an empty list.
Parameters
$indirection | Node |
Returns
list<IndirectionStep>Throws
ImplementationGap When a step has no ruleCalls 2
- method-call PrimaryRule::indirection() line 105
- new PrimaryRule line 105
public function comparison(Form $form): BinaryOperationLowers one of the six comparison productions of a_expr or b_expr.
Parameters
$form | Form |
Returns
Calls 5
- new BinaryOperation line 113
- new OperatorName line 113
- method-call Form::token() line 113
- method-call Expressions::expression() line 113
- method-call Form::node() line 113
Lowers c_expr: PARAM opt_indirection: the parameter, with the steps applied to it.
Parameters
$form | Form |
Returns
Calls 2
- method-call PrimaryRule::parameter() line 121
- new PrimaryRule line 121
Builds the negation of an operand written after a minus token, as a_expr: - a_expr does.
Other families use it where the grammar writes a minus before a constant outside an expression, such as select_fetch_first_value.
Returns
Calls 2
public function row(Node $row): list<Scalar>Lowers the fields of a row constructor: row, explicit_row or implicit_row.
Parameters
$row | Node |
Returns
list<Scalar>Calls 2
- method-call ConstructorRule::row() line 142
- new ConstructorRule line 142
public function rowConstructor(Node $row): RowConstructorLowers a row constructor: row, explicit_row or implicit_row.
Parameters
$row | Node |
Returns
Calls 2
- method-call ConstructorRule::row() line 150
- new ConstructorRule line 150
public function caseExpression(Node $case): CaseExpressionLowers a CASE expression: case_expr.
Parameters
$case | Node |
Returns
Calls 2
- method-call ConstructorRule::caseExpression() line 158
- new ConstructorRule line 158
public function arrayLiteral(Node $array): ArrayItemsLowers the bracketed items of an array constructor: array_expr.
Parameters
$array | Node |
Returns
Calls 2
- method-call ConstructorRule::items() line 166
- new ConstructorRule line 166
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ExpressionsTestcalls