classChangeChecks
final class ChangeChecks
Checks the attributes of ALTER OPERATOR ... SET and ALTER TYPE ... SET.
Rule: PG-ALTER-ATTRIBUTE-001. Both commands read each attribute in turn and stop at the first they refuse: an attribute they do not recognize is an error (not the warning of CREATE OPERATOR and CREATE TYPE); an attribute of the CREATE command that cannot be changed is an error (for an operator leftarg, rightarg, function, procedure, and before PostgreSQL 17 also commutator, negator, merges and hashes; for a type every attribute but storage, receive, send, typmod_in, typmod_out, analyze and subscript). Without a value a function attribute removes the function and a Boolean is true, while an operator attribute and storage require a parameter; a value the reading rejects draws the message of PG-DEFINE-ATTRIBUTE-001. Source: https://www.postgresql.org/docs/17/sql-alteroperator.html, https://www.postgresql.org/docs/17/sql-altertype.html, AlterOperator in src/backend/commands/operatorcmds.c and AlterType in src/backend/commands/typecmds.c of PostgreSQL 16 and 17. Termination: one pass over the attributes. Status: Implemented.
Methods§
public function derive(Derivation $derivation, list<AttributeChange> $changes, bool $type): voidReports the problem of each changed attribute; $type tells ALTER TYPE from ALTER OPERATOR.
Parameters
$derivation | Derivation | |
$changes | list<AttributeChange> | |
$type | bool |
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Catalog\Type\AlterTypeOptions::deriveStatement() packages/sql-semantics-postgres/src/Statement/Catalog/Type/AlterTypeOptions.php:57
- method-call SqlSemantics\Platform\PostgreSql\Statement\Operator\AlterOperator::deriveStatement() packages/sql-semantics-postgres/src/Statement/Operator/AlterOperator.php:68
Calls 2
- method-call ChangeChecks::problem() line 48
- method-call Derivation::report() line 50
public function problem(
Attribute $attribute,
bool $type,
GrammarRelease $release,
): ?AttributeProblemAnswers the problem the command reports for one attribute, or null when it accepts the attribute.
Parameters
$attribute | Attribute | |
$type | bool | |
$release | GrammarRelease |
Returns
Test cases 1
Called from 1
Calls 9
- new AttributeProblem line 63
- class-const AttributeProblemKind::UnrecognizedChangedTypeAttribute() line 63
- class-const AttributeProblemKind::UnrecognizedChangedOperatorAttribute() line 63
- method-call ChangeChecks::changeable() line 65
- class-const AttributeProblemKind::UnchangeableTypeAttribute() line 66
- class-const AttributeProblemKind::UnchangeableOperatorAttribute() line 66
- class-const Reading::Function() line 69
- method-call AttributeChecks::rejected() line 73
- new AttributeChecks line 73
public function changeable(KnownAttribute $known, GrammarRelease $release): boolTells whether the command changes a recognized attribute.
Parameters
$known | KnownAttribute | |
$release | GrammarRelease |
Returns
boolCalled from 1
Calls 8
- class-const OperatorChangeAttribute::Commutator() line 81
- class-const OperatorChangeAttribute::Negator() line 81
- class-const OperatorChangeAttribute::Merges() line 81
- class-const OperatorChangeAttribute::Hashes() line 81
- method-call KnownAttribute::reading() line 83
- class-const Reading::Ignored() line 83
- class-const GrammarRelease::PostgreSql166() line 83
- function-call
in_arrayline 83
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Statement\Catalog\Type\AlterTypeOptions::deriveStatement() packages/sql-semantics-postgres/src/Statement/Catalog/Type/AlterTypeOptions.php:57
- new SqlSemantics\Platform\PostgreSql\Statement\Operator\AlterOperator::deriveStatement() packages/sql-semantics-postgres/src/Statement/Operator/AlterOperator.php:68
Method calls 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Catalog\Type\AlterTypeOptions::deriveStatement() packages/sql-semantics-postgres/src/Statement/Catalog/Type/AlterTypeOptions.php:57
- method-call SqlSemantics\Platform\PostgreSql\Statement\Operator\AlterOperator::deriveStatement() packages/sql-semantics-postgres/src/Statement/Operator/AlterOperator.php:68