classDefineRule
final class DefineRule
Lowers DefineStmt: CREATE AGGREGATE, OPERATOR, TYPE, TEXT SEARCH objects and COLLATION.
Rule: PG-DEFINE-LOWER-001. Scope: DefineStmt, old_aggr_definition, old_aggr_list, old_aggr_elem. Constructors: Define, CopyCollation, and the catalog family's CreateComposite, CreateEnum and CreateRange for CREATE TYPE ... AS ( ... ), AS ENUM and AS RANGE, which PostgreSQL represents with their own nodes. Termination: lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-createaggregate.html, https://www.postgresql.org/docs/17/sql-createoperator.html, https://www.postgresql.org/docs/17/sql-createtype.html, https://www.postgresql.org/docs/17/sql-createcollation.html. Status: Implemented.
Methods§
Lowers DefineStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 10
- class-const DefineRule::SEARCH() line 71
- new Define line 72
- method-call DefineRule::attributes() line 72
- class-const ObjectKind::Aggregate() line 76
- method-call SignatureRule::aggregateArguments() line 76
- new SignatureRule line 76
- method-call DefineRule::old() line 77
- class-const ObjectKind::Operator() line 78
- class-const ObjectKind::Type() line 79
- method-call DefineRule::type() line 81
Lowers the composite, enum, range and collation forms of DefineStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 10
- new CreateComposite line 96
- new CreateEnum line 97
- new CreateRange line 98
- method-call DefineRule::read() line 98
- class-const RangeAttribute::class() line 98
- new Define line 99
- class-const ObjectKind::Collation() line 99
- method-call DefineRule::attributes() line 99
- new CopyCollation line 101
- static-call ImplementationGap::production() line 103
public function attributes(ObjectKind $kind, Node $definition): list<Attribute>Lowers definition into the attributes of the command that defines objects of a kind.
Parameters
$kind | ObjectKind | |
$definition | Node |
Returns
list<Attribute>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 6
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::define() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:72
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::define() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:76
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::define() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:78
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::define() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:79
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::type() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:99
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::type() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:100
Calls 3
- method-call DefineRule::read() line 116
- method-call AttributeReader::command() line 116
- new AttributeReader line 116
public function read(
class-string<KnownAttribute> $command,
list<array{Name, TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant|null}> $elements,
): list<Attribute>Reads written names and values as the attributes of a command.
Parameters
$command | class-string<KnownAttribute> | |
$elements | list<array{Name, TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant|null}> |
Returns
list<Attribute>Test cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::type() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:98
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::attributes() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:116
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Routine\DefineRule::old() packages/sql-semantics-postgres/src/Lowering/Routine/DefineRule.php:160
Calls 2
- new AttributeReader line 129
- method-call AttributeReader::attribute() line 132
Lowers old_aggr_definition: every attribute has a value and is named by an identifier.
Parameters
$definition | Node |
Returns
list<Attribute>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- static-call ImplementationGap::production() line 149
- method-call Lowering::items() line 152
- method-call DefineRule::read() line 160
- class-const AggregateAttribute::class() line 160
Private surface 2§
Implementation details, listed for orientation only.
private const SEARCH = ['DefineStmt: CREATE TEXT_P SEARCH PARSER any_name definition' => \SqlSemantics…private Lowering $loweringTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.