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

A value with an explicit collation: x COLLATE name.

Mirrors PostgreSQL's CollateClause node.

Rule: PG-COLLATE-001. Facts: the type and NULL fact of the operand; the collation is a catalog object a schema can define, so its name is not checked. A type that has no collation support makes the clause invalid. The operand must keep its place without parentheses (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-SYNTAX-COLLATE-EXPRS, https://www.postgresql.org/docs/17/collation.html. Status: Implemented.

Reading a collationdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT 'a' COLLATE \"C\"");
    [$query->field(0)->expression->collation->last()->value, $query->toString()] // => ['C', "SELECT 'a' COLLATE \"C\""]

Properties§

public Scalar $operand
public DottedName $collation

Methods§

public function __construct(public Scalar $operand, public DottedName $collation)

Parameters

$operandScalarThe value
$collationDottedNameThe collation name
Calls 4
public function outputName(): ?Name

Names an unaliased result column as the operand does.

Returns

Test cases 1
Calls 2
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand and checks that its type has collations.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand, COLLATE and the collation name.

Parameters

$outOutput
Test cases 1
Calls 4

Test cases 5§

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

Dedicated tests 5

Relations§

Instantiated in 1
Type checks 2