classJsonArrayQuery
final class JsonArrayQuery
implements Scalar, OutputNaming
uses Snapshot
@visibility public.JSON_ARRAY (query [FORMAT JSON] [RETURNING type]): the rows of a one-column query as a JSON array.
Mirrors PostgreSQL's JsonArrayQueryConstructor; the query is written without parentheses. Rule: PG-JSON-ARRAY-QUERY-001. Facts: the query is derived as a subquery at the position; the RETURNING type, otherwise json; never NULL. Diagnostics: a query of more than one column. The result column is named json_array. Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE. Status: Implemented.
is_subclass_of(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Constructor\JsonArrayQuery::class, \SqlSemantics\Platform\PostgreSql\Model\Statement\Scalar::class) // => trueProperties§
public Query $querypublic JsonFormat|null $format = nullpublic JsonReturning|null $returning = nullMethods§
public function __construct(
public Query $query,
public JsonFormat|null $format = null,
public JsonReturning|null $returning = null,
)Parameters
$query | Query | The query whose rows become the elements |
$format | JsonFormat|null | The format written for the query's values |
$returning | JsonReturning|null | The RETURNING clause |
public function outputName(): Namepublic function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the query and the returning type, reporting a query of several columns.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 8
- method-call Derivation::query() line 64
- method-call Derivation::report() line 66
- new JsonProblem line 66
- class-const JsonProblemKind::SubqueryColumns() line 66
- new ScalarFact line 70
- new Known line 70
- class-const Builtin::Json() line 70
- class-const Nullability::NotNull() line 70
public function render(Output $out): voidWrites JSON_ARRAY with the query and the clauses.
Parameters
$out | Output |
Calls 1
- method-call Output::keyword() line 78
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.