final class Expressions
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.

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§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe hub
public function expressions(Node $list): list<Scalar>

Lowers an expression list: expr_list.

Parameters

$listNode

Returns

list<Scalar>
Calls 2
public function columnReference(Node $reference): Scalar

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

$referenceNode

Returns

Calls 2
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

$indirectionNode

Returns

Throws

ImplementationGap When a step has no rule
Calls 2
public function comparison(Form $form): BinaryOperation

Lowers one of the six comparison productions of a_expr or b_expr.

Parameters

$formForm
Calls 5
public function parameter(Form $form): Scalar

Lowers c_expr: PARAM opt_indirection: the parameter, with the steps applied to it.

Parameters

$formForm

Returns

Calls 2
public function negation(Token $minus, Scalar $operand): Scalar

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.

Parameters

$minusToken
$operandScalar

Returns

Calls 2
public function row(Node $row): list<Scalar>

Lowers the fields of a row constructor: row, explicit_row or implicit_row.

Parameters

$rowNode

Returns

list<Scalar>
Calls 2
public function rowConstructor(Node $row): RowConstructor

Lowers a row constructor: row, explicit_row or implicit_row.

Parameters

$rowNode
Calls 2
public function caseExpression(Node $case): CaseExpression

Lowers a CASE expression: case_expr.

Parameters

$caseNode
Calls 2
public function arrayLiteral(Node $array): ArrayItems

Lowers the bracketed items of an array constructor: array_expr.

Parameters

$arrayNode

Returns

Calls 2

Private surface 1§

Implementation details, listed for orientation only.

private Lowering $lowering

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type declarations 1