classAlterCommandRule
final class AlterCommandRule
Lowers the actions of ALTER TABLE.
Rule: PG-ALTER-COMMAND-LOWER-001. Scope: alter_table_cmd, alter_column_default, alter_using, replica_identity, alter_identity_column_option_list, alter_identity_column_option, set_statistics_value, set_access_method_name. The optional COLUMN words are noise (LeafNoise opt_column, TableNoise ADD COLUMN), and so is SET DATA before TYPE (LeafNoise). Termination: lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-altertable.html. Status: Implemented.
Methods§
public function command(Node $command): AlterCommandLowers alter_table_cmd.
Parameters
$command | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 8
- class-const AlterCommandRule::TABLE() line 115
- new TableAction line 116
- class-const AlterCommandRule::NAMED() line 118
- new NamedAction line 121
- class-const AlterCommandRule::COLUMN() line 123
- new ColumnAction line 124
- method-call AlterCommandRule::column() line 129
- method-call AlterCommandRule::relation() line 129
public function column(Form $form): AlterCommandLowers an alter_table_cmd that changes one column.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 20
- method-call Form::node() line 140
- new ColumnStatistics line 143
- method-call AlterCommandRule::statistics() line 143
- new ColumnRule line 145
- method-call AlterCommandRule::defaulted() line 148
- new ColumnAttributes line 150
- new ColumnStorageChange line 152
- method-call ColumnRule::storage() line 152
- static-call ImplementationGap::production() line 152
- method-call ColumnRule::compression() line 153
- new AddIdentity line 154
- method-call ColumnRule::when() line 154
- method-call SequenceRule::parenthesized() line 154
- new SequenceRule line 154
- new AlterIdentity line 155
- method-call AlterCommandRule::identity() line 155
- new TypeChange line 156
- method-call AlterCommandRule::using() line 160
- new ColumnForeignOptions line 162
- new SetExpression line 163
public function relation(Form $form): AlterCommandLowers an alter_table_cmd that adds or drops a column or changes the relation.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 9
- new ColumnRule line 176
- new AddColumn line 180
- method-call ColumnRule::column() line 180
- method-call Form::node() line 180
- new DropColumn line 184
- new AddConstraint line 186
- new AlterConstraint line 187
- new DropConstraint line 188
- method-call AlterCommandRule::setting() line 190
public function setting(Form $form): AlterCommandLowers an alter_table_cmd that changes a property of the relation.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 11
- new InheritanceChange line 204
- new ParentTable line 204
- method-call Form::node() line 204
- new OfComposite line 206
- new OwnerTo line 207
- new SetAccessMethod line 208
- method-call AlterCommandRule::method() line 209
- new RelationOptions line 210
- method-call AlterCommandRule::replica() line 212
- new ForeignOptions line 213
- static-call ImplementationGap::production() line 214
public function defaulted(Name $column, Node $change): AlterCommandLowers alter_column_default for a column.
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- method-call AlterCommandRule::defaultValue() line 225
- new ColumnAction line 227
- class-const ColumnActionKind::DropDefault() line 227
- new DefaultChange line 227
Lowers alter_column_default: the expression of SET DEFAULT, or null for DROP DEFAULT.
Parameters
$change | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::defaulted() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:225
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::columnDefault() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:154
Calls 1
- static-call ImplementationGap::production() line 242
Lowers alter_using; none is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 1
- static-call ImplementationGap::production() line 258
public function statistics(Node $value): ?SignedNumberLowers the statistics target: SignedIconst or set_statistics_value; DEFAULT is null.
Parameters
$value | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::column() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:143
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::column() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:149
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\MaintenanceRule::alterStatistics() packages/sql-semantics-postgres/src/Lowering/Table/MaintenanceRule.php:104
Calls 1
- static-call ImplementationGap::production() line 277
Lowers set_access_method_name; DEFAULT is null.
Parameters
$value | Node |
Returns
?NameThrows
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 1
- static-call ImplementationGap::production() line 293
public function replica(Node $identity): ReplicaIdentityLowers replica_identity.
Parameters
$identity | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 6
- new ReplicaIdentity line 307
- class-const ReplicaIdentityKind::Nothing() line 307
- class-const ReplicaIdentityKind::Full() line 308
- class-const ReplicaIdentityKind::Default() line 309
- class-const ReplicaIdentityKind::Index() line 310
- static-call ImplementationGap::production() line 311
public function identity(Node $list): list<IdentityRestart|IdentitySetting|IdentityGeneration>Lowers alter_identity_column_option_list.
Parameters
$list | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 9
- method-call Lowering::items() line 325
- new IdentityRestart line 328
- new IdentitySetting line 330
- method-call SequenceRule::option() line 330
- new SequenceRule line 330
- new IdentityGeneration line 331
- method-call ColumnRule::when() line 331
- new ColumnRule line 331
- static-call ImplementationGap::production() line 332
Private surface 4§
Implementation details, listed for orientation only.
private const TABLE = ['alter_table_cmd: SET WITHOUT OIDS' => \SqlSemantics\Platform\PostgreSql\State…private const NAMED = ['alter_table_cmd: CLUSTER ON name' => [\SqlSemantics\Platform\PostgreSql\State…private const COLUMN = ['alter_table_cmd: ALTER opt_column ColId DROP NOT NULL_P' => \SqlSemantics\Pla…private Lowering $loweringTest cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
AlterCommandRuleTest::testColumnLowersAStatisticsTargetByNumbercallsAlterCommandRuleTest::testCommandLowersANamedActioncallsAlterCommandRuleTest::testDefaultedIsADropDefaultActioncallsAlterCommandRuleTest::testDefaultValueLowersTheExpressioncallsAlterCommandRuleTest::testIdentityKeepsTheOrdercallsAlterCommandRuleTest::testMethodIsNullForDefaultcallsAlterCommandRuleTest::testRelationLowersADroppedColumncallsAlterCommandRuleTest::testReplicaLowersUsingIndexcallsAlterCommandRuleTest::testSettingLowersReplicaIdentitycallsAlterCommandRuleTest::testStatisticsIsNullForDefaultcallsAlterCommandRuleTest::testUsingIsNullWhenNotWrittencalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterTableRule::commands() packages/sql-semantics-postgres/src/Lowering/Table/AlterTableRule.php:116
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\MaintenanceRule::alterStatistics() packages/sql-semantics-postgres/src/Lowering/Table/MaintenanceRule.php:104
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::columnDefault() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:154
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterTableRule::commands() packages/sql-semantics-postgres/src/Lowering/Table/AlterTableRule.php:118
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\MaintenanceRule::alterStatistics() packages/sql-semantics-postgres/src/Lowering/Table/MaintenanceRule.php:104
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::columnDefault() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:154