classModifiers
final class Modifiers
Applies type modifiers to a catalog type.
Rule: PG-TYPE-MODIFIER-001. Scope: the modifier lists of Numeric, Bit, Character, ConstDatetime, ConstInterval and GenericType. Facts: no modifier gives the catalog type; numeric takes a precision of 1 to 1000 and an optional scale of -1000 to 1000; character and character varying take a length of 1 to 10485760; bit and bit varying a length of 1 to 83886080; the time, timestamp and interval types a precision that is not negative and is reduced to 6 above 6. Diagnostics: a modifier that is not an integer constant, a wrong count, a value out of range, and modifiers on any other type are ModifierProblem. Minimum precision: Known for every list of integer constants in range. Source: https://www.postgresql.org/docs/17/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL, https://www.postgresql.org/docs/17/datatype-character.html, https://www.postgresql.org/docs/17/datatype-bit.html, https://www.postgresql.org/docs/17/datatype-datetime.html. Termination: one pass over the modifiers. Status: Implemented.
Methods§
Answers the type a catalog type becomes under modifier expressions.
Parameters
$base | Builtin | |
$modifiers | list<Scalar> |
Returns
Test cases 3
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\BitDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/BitDesignation.php:63
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\DecimalDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/DecimalDesignation.php:55
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\NamedDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/NamedDesignation.php:62
Calls 4
- new Invalid line 60
- new ModifierProblem line 60
- method-call Builtin::name() line 60
- method-call Modifiers::constrained() line 65
Answers the type a catalog type becomes under integer modifiers.
Parameters
$base | Builtin | |
$values | list<string> | Canonical decimal integers with an optional minus sign |
Returns
Test cases 2
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Typing\Modifiers::apply() packages/sql-semantics-postgres/src/Rules/Typing/Modifiers.php:65
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\CharacterDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/CharacterDesignation.php:69
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\DatetimeDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/DatetimeDesignation.php:62
Calls 16
- new Known line 76
- function-call
strlenline 80 - function-call
ltrimline 80 - new Invalid line 81
- new ModifierProblem line 81
- method-call Builtin::name() line 81
- class-const Builtin::Numeric() line 86
- function-call
countline 87 - function-call
absline 87 - new Parameterized line 89
- class-const Modifiers::LENGTHS() line 91
- function-call
in_arrayline 94 - class-const Modifiers::PRECISIONS() line 94
- class-const Builtin::Interval() line 95
- new IntervalSpan line 95
- function-call
minline 95
Private surface 2§
Implementation details, listed for orientation only.
private const LENGTHS = ['bpchar' => 10485760, 'varchar' => 10485760, 'bit' => 83886080, 'varbit' => 83…private const PRECISIONS = ['time', 'timetz', 'timestamp', 'timestamptz', 'interval']Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ModifiersTest::testApplyAnswersTheCatalogTypeWithoutModifierscallsModifiersTest::testApplyReadsIntegerConstantscallsModifiersTest::testApplyReportsAModifierThatIsNotAnIntegerConstantcallsModifiersTest::testConstrainedChecksTheRangeEachTypeAcceptscallsModifiersTest::testConstrainedReducesAPrecisionAboveSixcalls
Relations§
Instantiated in 5
- new SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\BitDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/BitDesignation.php:63
- new SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\CharacterDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/CharacterDesignation.php:69
- new SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\DatetimeDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/DatetimeDesignation.php:62
- new SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\DecimalDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/DecimalDesignation.php:55
- new SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\NamedDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/NamedDesignation.php:62
Method calls 5
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\BitDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/BitDesignation.php:63
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\CharacterDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/CharacterDesignation.php:69
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\DatetimeDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/DatetimeDesignation.php:62
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\DecimalDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/DecimalDesignation.php:55
- method-call SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\NamedDesignation::typeFact() packages/sql-semantics-postgres/src/Statement/Type/Designation/NamedDesignation.php:62