classTableFunctionShapes
final class TableFunctionShapes
Derives the columns of XMLTABLE and JSON_TABLE used as FROM items.
Rule: PG-XMLTABLE-001 / PG-JSON-TABLE-001. Every expression is derived where the FROM items before the table are visible. A FOR ORDINALITY column is an integer that is never NULL; every other column has its declared type and can be NULL, except an XMLTABLE column declared NOT NULL. The nested columns of JSON_TABLE follow in written order. XMLTABLE reports a second FOR ORDINALITY column, repeated PATH, DEFAULT or NULL options, and an option word other than path and default; JSON_TABLE reports a row path that is not a string constant and the behaviors a column does not accept. The column aliases rename the columns (PG-COLUMN-ALIAS-001). Source: https://www.postgresql.org/docs/17/functions-xml.html#FUNCTIONS-XML-PROCESSING-XMLTABLE, https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-SQLJSON-TABLE. Status: Implemented.
Methods§
public function xml(
XmlTable $table,
Derivation $derivation,
Environment $environment,
): RelationFactDerives XMLTABLE and answers its columns.
Parameters
$table | XmlTable | |
$derivation | Derivation | |
$environment | Environment |
Returns
Called from 1
Calls 14
- method-call Derivation::scalar() line 60
- new OutputSlot line 69
- new Known line 69
- class-const Builtin::Int4() line 69
- class-const Nullability::NotNull() line 69
- method-call TableFunctionShapes::options() line 73
- class-const Nullability::Nullable() line 73
- method-call Derivation::report() line 76
- new QueryMisuse line 76
- class-const QueryMisuseRule::RepeatedOrdinality() line 76
- new RelationFact line 79
- method-call ColumnAliases::apply() line 79
- new ColumnAliases line 79
- new RowShape line 79
public function options(
XmlTableColumn $column,
Derivation $derivation,
Environment $environment,
): boolDerives the options of an XMLTABLE column, reports the misused ones and tells whether NOT NULL is written.
Parameters
$column | XmlTableColumn | |
$derivation | Derivation | |
$environment | Environment |
Returns
boolCalled from 1
Calls 12
- method-call Derivation::scalar() line 91
- class-const XmlColumnOptionKind::Default() line 95
- class-const XmlColumnOptionKind::Path() line 96
- class-const XmlColumnOptionKind::NotNull() line 97
- class-const XmlColumnOptionKind::Null() line 97
- class-const XmlColumnOptionKind::Named() line 98
- method-call Derivation::report() line 102
- new QueryMisuse line 102
- class-const QueryMisuseRule::UnrecognizedColumnOption() line 102
- class-const QueryMisuseRule::RedundantNullability() line 107
- class-const QueryMisuseRule::RepeatedDefault() line 107
- class-const QueryMisuseRule::RepeatedPath() line 107
public function json(
JsonTable $table,
Derivation $derivation,
Environment $environment,
): RelationFactDerives JSON_TABLE and answers its columns.
Parameters
$table | JsonTable | |
$derivation | Derivation | |
$environment | Environment |
Returns
Called from 1
Calls 10
- method-call Derivation::scalar() line 126
- method-call Derivation::report() line 128
- new QueryMisuse line 128
- class-const QueryMisuseRule::PathNotConstant() line 128
- method-call TableFunctionShapes::clause() line 133
- new RelationFact line 135
- method-call ColumnAliases::apply() line 135
- new ColumnAliases line 135
- new RowShape line 135
- method-call TableFunctionShapes::columns() line 135
public function columns(
list<JsonTableColumn> $columns,
Derivation $derivation,
Environment $environment,
): list<OutputSlot>Derives JSON_TABLE column definitions, the nested ones included, and answers their slots in order.
Parameters
$columns | list<JsonTableColumn> | |
$derivation | Derivation | |
$environment | Environment |
Returns
list<OutputSlot>Test cases 1
Called from 1
Calls 8
- function-call
array_reverseline 147 - function-call
array_popline 149 - function-call
array_pushline 151 - new OutputSlot line 153
- new Known line 153
- class-const Builtin::Int4() line 153
- class-const Nullability::NotNull() line 153
- method-call TableFunctionShapes::typed() line 155
public function typed(
JsonValueColumn|JsonExistsColumn $column,
Derivation $derivation,
Environment $environment,
): OutputSlotDerives a value or EXISTS column and answers its slot.
Parameters
$column | JsonValueColumn|JsonExistsColumn | |
$derivation | Derivation | |
$environment | Environment |
Returns
Called from 1
Calls 8
- method-call TableFunctionShapes::clause() line 169
- class-const JsonFunctionKind::Exists() line 170
- class-const JsonFunctionKind::Query() line 176
- class-const JsonFunctionKind::Value() line 176
- method-call JsonChecks::behaviors() line 180
- new JsonChecks line 180
- new OutputSlot line 183
- class-const Nullability::Nullable() line 183
public function clause(?Node $clause, Derivation $derivation, Environment $environment): voidDerives an optional clause.
Parameters
$clause | ?Node | |
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::json() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:133
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::typed() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:169
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::typed() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:174
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Statement\Relation\Json\JsonTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/Json/JsonTable.php:86
- new SqlSemantics\Platform\PostgreSql\Statement\Relation\Xml\XmlTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/Xml/XmlTable.php:83
Method calls 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\Json\JsonTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/Json/JsonTable.php:86
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\Xml\XmlTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/Xml/XmlTable.php:83