classAttributeChecks
final class AttributeChecks
Reports the attributes of a definition that their command does not recognize or cannot read.
Rule: PG-DEFINE-ATTRIBUTE-001. An attribute the command does not recognize draws the command's message: a warning for an operator, an aggregate and a base type, an error for a range type, a collation and a text search parser, template or configuration; a text search dictionary passes every other attribute to its template. A recognized attribute whose value its defGet* function rejects draws that function's message. A read value is further checked where the command checks it without a catalog: SETOF in an operator argument type, a type category outside printable ASCII, and the builtin collation provider before PostgreSQL 17. A base type, a range type and a collation take each attribute once (analyze and analyse are one attribute). Terminates: one pass over the attributes. Source: src/backend/commands/define.c, DefineOperator in src/backend/commands/operatorcmds.c, DefineAggregate in src/backend/commands/aggregatecmds.c, DefineType and DefineRange in src/backend/commands/typecmds.c, DefineCollation in src/backend/commands/collationcmds.c and src/backend/commands/tsearchcmds.c of PostgreSQL 16 and 17. Status: Implemented.
Methods§
public function derive(
Derivation $derivation,
class-string<KnownAttribute> $command,
list<Attribute> $attributes,
bool $once,
): voidReports the problems of each attribute and, when each attribute is taken once, every repetition.
Parameters
$derivation | Derivation | |
$command | class-string<KnownAttribute> | The attribute set of the command |
$attributes | list<Attribute> | |
$once | bool |
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::derive() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:65
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::range() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:86
Calls 7
- method-call AttributeChecks::unrecognized() line 82
- method-call AttributeChecks::value() line 82
- method-call Derivation::report() line 84
- class-const BaseTypeAttribute::Analyse() line 86
- class-const BaseTypeAttribute::Analyze() line 86
- new AttributeProblem line 88
- class-const AttributeProblemKind::Conflicting() line 88
public function unrecognized(
class-string<KnownAttribute> $command,
Attribute $attribute,
): ?AttributeProblemAnswers the problem the command reports for an attribute it does not recognize, or null when it passes the attribute on.
Parameters
$command | class-string<KnownAttribute> | |
$attribute | Attribute |
Returns
Test cases 1
Called from 1
Calls 2
- class-const AttributeChecks::UNRECOGNIZED() line 101
- new AttributeProblem line 103
public function value(
Attribute $attribute,
KnownAttribute $known,
GrammarRelease $release,
): ?AttributeProblemAnswers the problem with the value of a recognized attribute, or null.
Parameters
$attribute | Attribute | |
$known | KnownAttribute | |
$release | GrammarRelease |
Returns
Test cases 1
Called from 1
Calls 14
- method-call AttributeChecks::rejected() line 113
- method-call KnownAttribute::reading() line 113
- new ArgumentText line 115
- class-const OperatorAttribute::Leftarg() line 118
- class-const OperatorAttribute::Rightarg() line 118
- new AttributeProblem line 118
- class-const AttributeProblemKind::SetofArgument() line 118
- class-const BaseTypeAttribute::Category() line 119
- method-call AttributeChecks::printable() line 119
- method-call ArgumentText::text() line 119
- class-const AttributeProblemKind::InvalidCategory() line 119
- class-const CollationProvider::Builtin() line 120
- class-const GrammarRelease::PostgreSql166() line 120
- class-const AttributeProblemKind::InvalidProvider() line 120
public function rejected(
Reading $reading,
string $name,
TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant|null $value,
): ?AttributeProblemAnswers the problem the command reports for a value it cannot read, or null for a value it does not read.
Parameters
$reading | Reading | |
$name | string | |
$value | TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant|null |
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\AttributeChecks::value() packages/sql-semantics-postgres/src/Rules/Routine/AttributeChecks.php:113
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\ChangeChecks::problem() packages/sql-semantics-postgres/src/Rules/Routine/ChangeChecks.php:73
Calls 25
- class-const Reading::Ignored() line 130
- new AttributeProblem line 134
- class-const Reading::Integer() line 134
- class-const AttributeProblemKind::NotAnInteger() line 134
- class-const AttributeProblemKind::MissingParameter() line 134
- method-call Reading::kind() line 136
- class-const AttributeProblemKind::NotAName() line 137
- method-call ArgumentText::text() line 139
- new ArgumentText line 139
- class-const Reading::Type() line 142
- class-const AttributeProblemKind::NotATypeName() line 142
- class-const Reading::Boolean() line 143
- class-const AttributeProblemKind::NotABoolean() line 143
- class-const Reading::Length() line 144
- class-const AttributeProblemKind::InvalidLength() line 145
- class-const Reading::Parallelism() line 146
- class-const AttributeProblemKind::InvalidParallel() line 146
- class-const Reading::FinalModification() line 147
- class-const AttributeProblemKind::InvalidModify() line 147
- class-const Reading::Alignment() line 148
- class-const AttributeProblemKind::InvalidAlignment() line 148
- class-const Reading::Storage() line 149
- class-const AttributeProblemKind::InvalidStorage() line 149
- class-const Reading::Provider() line 150
- class-const AttributeProblemKind::InvalidProvider() line 150
public function printable(string $category): boolTells whether the first character of a type category is printable ASCII, as the server requires.
Parameters
$category | string |
Returns
boolTest cases 1
Called from 1
Calls 1
- function-call
ordline 160
Private surface 1§
Implementation details, listed for orientation only.
private const UNRECOGNIZED = [\SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Known\OperatorAtt…Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Rules\Routine\ChangeChecks::problem() packages/sql-semantics-postgres/src/Rules/Routine/ChangeChecks.php:73
- new SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::derive() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:65
- new SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::range() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:86
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\ChangeChecks::problem() packages/sql-semantics-postgres/src/Rules/Routine/ChangeChecks.php:73
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::derive() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:65
- method-call SqlSemantics\Platform\PostgreSql\Rules\Routine\DefineChecks::range() packages/sql-semantics-postgres/src/Rules/Routine/DefineChecks.php:86