classNormalizationTest
final class NormalizationTest
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A test of whether a string is in a Unicode normal form: a IS [NOT] [NFC|NFD|NFKC|NFKD] NORMALIZED.
The parser reads it as a call of pg_catalog.is_normalized(a, form); the form defaults to NFC.
Rule: PG-NORMALIZATION-TEST-001. Facts: boolean for a text operand (or a string constant read as text), NULL when the operand can be; any other operand type is reported. The operand must keep its place before IS (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-string.html#FUNCTIONS-STRING-SQL. Status: Implemented.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT 'a' IS NOT NFKC NORMALIZED");
[$query->field(0)->expression->form, $query->toString()] // => [\SqlSemantics\Platform\PostgreSql\Statement\Option\NormalForm::Nfkc, "SELECT 'a' IS NOT NFKC NORMALIZED"]Properties§
public Scalar $operandpublic bool $negatedpublic NormalForm|null $form = nullMethods§
public function __construct(
public Scalar $operand,
public bool $negated,
public NormalForm|null $form = null,
)Parameters
$operand | Scalar | The tested string |
$negated | bool | Whether NOT is written |
$form | NormalForm|null | The normal form, or null when none is written |
Calls 4
- static-call Check::input() line 47
- method-call Precedence::before() line 47
- new Precedence line 47
- class-const Precedence::IS() line 47
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand and checks that it is text.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 9
- method-call Derivation::scalar() line 55
- new OperandChecks line 56
- new ScalarFact line 58
- method-call OperandChecks::accepted() line 58
- class-const Builtin::Text() line 58
- class-const Builtin::Varchar() line 58
- class-const Builtin::Bpchar() line 58
- class-const Builtin::Name() line 58
- method-call OperandChecks::nullability() line 58
public function render(Output $out): voidWrites the value and the test.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::node() line 66
- method-call Output::keyword() line 68
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\PredicateRule::tests() packages/sql-semantics-postgres/src/Lowering/Expression/PredicateRule.php:173
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\PredicateRule::tests() packages/sql-semantics-postgres/src/Lowering/Expression/PredicateRule.php:174
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\PredicateRule::tests() packages/sql-semantics-postgres/src/Lowering/Expression/PredicateRule.php:175
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\PredicateRule::tests() packages/sql-semantics-postgres/src/Lowering/Expression/PredicateRule.php:176