classXmlChecks
final class XmlChecks
Reports the SQL/XML constructors the server rejects while analyzing them.
Rule: PG-XML-CHECKS-001. An attribute of XMLELEMENT, or a value of XMLFOREST, without AS takes the name of the column it references, so it must be a column reference; the attribute names of one element, written or taken, are distinct (compared exactly); XMLSERIALIZE produces a character string type: text, character varying or character. Source: https://www.postgresql.org/docs/17/functions-xml.html#FUNCTIONS-PRODUCING-XML, transformXmlExpr and transformXmlSerialize in src/backend/parser/parse_expr.c of PostgreSQL 17. Termination: one pass over the values. Status: Implemented.
Methods§
public function attributes(Derivation $derivation, list<XmlAttribute> $attributes): voidReports unnamed attributes that are not column references and attribute names used twice.
Parameters
$derivation | Derivation | |
$attributes | list<XmlAttribute> |
Test cases 1
Called from 1
Calls 5
- method-call Derivation::report() line 48
- new XmlProblem line 48
- class-const XmlProblemKind::UnnamedAttribute() line 48
- function-call
in_arrayline 51 - class-const XmlProblemKind::RepeatedAttribute() line 52
public function elements(Derivation $derivation, list<XmlAttribute> $elements): voidReports unnamed XMLFOREST values that are not column references.
Parameters
$derivation | Derivation | |
$elements | list<XmlAttribute> |
Test cases 1
Called from 1
Calls 3
- method-call Derivation::report() line 67
- new XmlProblem line 67
- class-const XmlProblemKind::UnnamedElement() line 67
public function serialized(Derivation $derivation, TypeFact $type): TypeFactAnswers the type of an XMLSERIALIZE result, reporting a type that is not a character string type.
Parameters
$derivation | Derivation | |
$type | TypeFact |
Returns
Test cases 1
Called from 1
Calls 8
- function-call
in_arrayline 80 - method-call Coercions::descriptor() line 80
- new Coercions line 80
- class-const XmlChecks::SERIALIZED() line 80
- new XmlProblem line 83
- class-const XmlProblemKind::SerializeTarget() line 83
- method-call Derivation::report() line 84
- new Invalid line 86
Private surface 1§
Implementation details, listed for orientation only.
private const SERIALIZED = ['text', 'varchar', 'bpchar']Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlElement::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlElement.php:80
- new SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlForest::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlForest.php:69
- new SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlSerialize::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlSerialize.php:70
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlElement::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlElement.php:80
- method-call SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlForest::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlForest.php:69
- method-call SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlSerialize::deriveScalar() packages/sql-semantics-postgres/src/Statement/Invocation/Xml/XmlSerialize.php:70