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

The entry point of PostgreSQL lowering: a parse tree in, statements out.

Every family reaches the others through the entry objects held here; an entry method is named after what it lowers and documents the nonterminals it accepts. Rules hold the hub, never each other.

Rule: PG-STATEMENT-001. Scope: parse_toplevel, stmtmulti, toplevel_stmt, stmt. Each statement of the text becomes one statement; an empty statement between semicolons requests nothing and produces none. Termination: the statement list is flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-commands.html. Status: Implemented.

Properties§

public Names $names

Identifiers and names.

public Roles $roles

Role specifications.

public Operators $operators

Operator names.

public Literals $literals

Constants and parameters.

public Options $options

Definition lists, storage parameters, foreign-data options and configuration values.

public Flags $flags

Optional keywords shared by several families.

public TypeNames $types

Type names.

public Expressions $expressions

Scalar expressions.

public Invocations $invocations

Function calls and function-like expressions.

public Queries $queries

Queries and their clauses.

public Manipulations $manipulations

Data-modifying statements, prepared statements and cursors.

public Tables $tables

Table, sequence, index, view, trigger, rule and policy definitions.

public Catalogs $catalogs

Schemas, databases, extensions, foreign data, languages, publications, text search, domains, types and casts.

public Routines $routines

Routines, operators, operator classes and the generic object commands.

public Privileges $privileges

Roles and privileges.

public UtilityCommands $utilities

Transactions, configuration, maintenance and the other utility commands.

public Productions $productions
public Leaves $leaves
public GrammarRelease $release

Methods§

public function __construct(
    public Productions $productions,
    public Leaves $leaves,
    public GrammarRelease $release,
)

Parameters

$productionsProductionsThe productions of the grammar release
$leavesLeavesThe record of operand leaves this lowering creates
$releaseGrammarReleaseThe grammar release, for rules that differ between releases
Calls 16
public function statements(Node $tree): list<Statement>

Lowers a parse tree into the statements it requests, in order.

Parameters

$treeNode

Returns

list<Statement>

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 7
public function items(Node $list, string ...$spine): list<Node>

Answers the items of a recursive list production in source order, without recursing on the list spine.

Every node of the spine must match one of the given productions, so a list rule claims exactly the list productions it names.

Parameters

$listNode
$spinestringThe signatures of the list productions

Returns

list<Node>

Throws

ImplementationGap When a node of the spine matches another production
Test cases 2
Called from 99
Calls 5
public function statement(Node $statement): Statement

Lowers a statement nonterminal, such as SelectStmt or CreateStmt, at the top level or nested in another statement.

Parameters

$statementNode

Returns

Throws

ImplementationGap When the nonterminal is not a statement of the grammar
Test cases 2
Called from 3
Calls 16

Test cases 549§

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

Dedicated tests 6
Other tests reaching this symbol 543

Relations§

Instantiated in 1
Method calls 102
Type declarations 89