classArraySubquery
final class ArraySubquery
implements Scalar, OutputNaming
uses Snapshot
@visibility public.An array of the values a query returns: ARRAY(SELECT …).
Mirrors PostgreSQL's SubLink node of kind ARRAY_SUBLINK.
Rule: PG-ARRAY-SUBQUERY-001. The query is derived in the environment of the expression and must return one column. Facts: an array of the column's type (an array column gives an array of one more dimension, which has the same type); never NULL, since no row gives an empty array; an unaliased result column is named array. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT ARRAY(SELECT 1)')->field(0)->type->descriptor->name() // => 'integer[]'Properties§
public Query $queryMethods§
public function __construct(public Query $query)Parameters
$query | Query | The query inside the parentheses |
public function outputName(): NameNames an unaliased result column array.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the query and the array type of its column.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call Derivation::query() line 59
- new ScalarFact line 61
- method-call Sublinks::array() line 61
- new Sublinks line 61
- class-const Nullability::NotNull() line 61
public function render(Output $out): voidWrites ARRAY and the query in parentheses.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 69
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.