classDocumentTest
final class DocumentTest
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A test of whether an XML value is a document: a IS [NOT] DOCUMENT.
Mirrors PostgreSQL's XmlExpr node of kind IS_DOCUMENT (negated by a NOT).
Rule: PG-DOCUMENT-TEST-001. Facts: boolean when the operand is xml or an unknown-typed constant read as xml, 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-xml.html#FUNCTIONS-XML-PREDICATES. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT '<a/>' IS DOCUMENT")->field(0)->type->descriptor->name() // => 'boolean'Properties§
public Scalar $operandpublic bool $negatedMethods§
public function __construct(public Scalar $operand, public bool $negated)Parameters
$operand | Scalar | The tested XML value |
$negated | bool | Whether NOT is written |
Calls 4
- static-call Check::input() line 43
- method-call Precedence::before() line 43
- new Precedence line 43
- class-const Precedence::IS() line 43
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand and checks that it is XML.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call Derivation::scalar() line 51
- new OperandChecks line 52
- new ScalarFact line 54
- method-call OperandChecks::accepted() line 54
- class-const Builtin::Xml() line 54
- method-call OperandChecks::nullability() line 54
public function render(Output $out): voidWrites the value and the test.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::node() line 62
- method-call Output::keyword() line 64
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\OperatorRule::postfix() packages/sql-semantics-postgres/src/Lowering/Expression/OperatorRule.php:123
- new SqlSemantics\Platform\PostgreSql\Lowering\Expression\OperatorRule::postfix() packages/sql-semantics-postgres/src/Lowering/Expression/OperatorRule.php:124
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Precedence::predicates() packages/sql-semantics-postgres/src/Rules/Expression/Precedence.php:248
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Expression\Precedence::restricted() packages/sql-semantics-postgres/src/Rules/Expression/Precedence.php:285