classBodyFacts
final class BodyFacts
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,
): voidDerives the statements in the environment of the body.
Parameters
$statements | list<Statement|ReturnStatement> | |
$derivation | Derivation | |
$environment | Environment |
Called from 1
Calls 6
- method-call BodyFacts::first() line 49
- method-call Derivation::query() line 50
- method-call Derivation::report() line 53
- new RoutineProblem line 53
- class-const RoutineProblemKind::UtilityInBody() line 53
- method-call Derivation::inspected() line 54
Answers the first selection of a query, whose INTO clause makes the query a utility command.
Parameters
$query | Query |
Returns
Test cases 1
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.