final class ColumnKey
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A column written by name as the key of an index, a partition key or extended statistics.

Mirrors the name of PostgreSQL's IndexElem, PartitionElem and StatsElem. The name is resolved as a column of the indexed relation, which is the only relation visible there. Source: https://www.postgresql.org/docs/17/sql-createindex.html.

Resolving an indexed columndoctest
$semantics = new \SqlSemantics\Platform\PostgreSql\Semantics();
    $table = $semantics->analyze('CREATE TABLE t (a int, b text)');
    $index = $semantics->analyze('CREATE INDEX i ON t (b)', $table->declarations());
    $index->facts->scalar($index->statement->elements[0]->key)->resolution->slot->column === $table->declarations()[0]->columns[1] // => true

Properties§

public Name $column

Methods§

public function __construct(public Name $column)

Parameters

$columnNameThe column name
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Resolves the name as a column.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 2
public function render(Output $out): void

Writes the name.

Parameters

$outOutput
Calls 1

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 3
Type checks 1
Type declarations 3