final class JsonNestedColumns
    implements JsonTableColumn
    uses Snapshot
Public API: explicitly declared with @visibility public.

NESTED [PATH] path [AS name] COLUMNS (…): columns read from the items a path yields within the row.

Mirrors PostgreSQL's JsonTableColumn of type JTC_NESTED. The PATH word is optional and always written. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-SQLJSON-TABLE.

Reading nested columnsdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics('pg-17.2'))->analyze("SELECT * FROM JSON_TABLE ('[]', '$[*]' COLUMNS (NESTED '$.b[*]' COLUMNS (b text)))");
    [$query->field(0)->name->value, $query->toString()] // => ['b', "SELECT * FROM JSON_TABLE ('[]', '$[*]' COLUMNS (NESTED PATH '$.b[*]' COLUMNS (b text)))"]

Properties§

public non-empty-list<JsonTableColumn> $columns
public Name|null $pathName = null

Methods§

public function __construct(
    public StringConstant $path,
    list<JsonTableColumn> $columns,
    public Name|null $pathName = null,
)

Parameters

$pathStringConstantThe path of the nested items
$columnslist<JsonTableColumn>The nested columns in written order; at least one
$pathNameName|nullThe name of the path
Calls 2
public function render(Output $out): void

Writes NESTED PATH, the path, its name and the columns.

Parameters

$outOutput
Calls 2

Test cases 2§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Type checks 1
Type declarations 1