final class BodyFacts
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Derives the statements of a BEGIN ATOMIC routine body.

Rule: PG-ROUTINE-BODY-001. Each statement is analyzed when the routine is created, with the parameters visible as the outermost scope (PG-ROUTINE-PARAMETERS-001): a query or a data-modifying statement is derived as a nested query in that environment, so its own relations shadow the parameters and it returns no rows of the CREATE statement; RETURN derives its expression there. Any other statement, and a SELECT INTO, is a utility command, which the server does not accept in an SQL-standard body; it is derived on its own and reported. Terminates: one pass over the list. Source: https://www.postgresql.org/docs/17/sql-createfunction.html, interpret_AS_clause in src/backend/commands/functioncmds.c of PostgreSQL 17. Status: Implemented.

Methods§

public function derive(
    list<Statement|ReturnStatement> $statements,
    Derivation $derivation,
    Environment $environment,
): void
public function first(Query $query): ?Select

Answers the first selection of a query, whose INTO clause makes the query a utility command.

Parameters

$queryQuery

Returns

Test cases 1
Called from 1

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
Method calls 1