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.

Testing an XML constantdoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT '<a/>' IS DOCUMENT")->field(0)->type->descriptor->name() // => 'boolean'

Properties§

public Scalar $operand
public bool $negated

Methods§

public function __construct(public Scalar $operand, public bool $negated)

Parameters

$operandScalarThe tested XML value
$negatedboolWhether NOT is written
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand and checks that it is XML.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 6
public function render(Output $out): void

Writes the value and the test.

Parameters

$outOutput
Test cases 1
Calls 2

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
Type checks 2