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

The SQL-standard test of whether a query returns no duplicate rows: UNIQUE [NULLS [NOT] DISTINCT] (SELECT …).

The grammar accepts the predicate, and the server rejects it while parsing because it does not implement it.

Rule: PG-UNIQUE-PREDICATE-001. The query is derived in the environment of the expression. Facts: the predicate is reported as not implemented, and its type is invalid. Source: https://www.postgresql.org/docs/17/features.html (feature F291), the grammar action of a_expr: UNIQUE …. Status: Implemented.

Reporting the predicatedoctest
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT UNIQUE NULLS NOT DISTINCT (SELECT 1)') // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\SemanticException: UNIQUE predicate is not yet implemented.

Properties§

public bool|null $nullsDistinct
public Query $query

Methods§

public function __construct(public bool|null $nullsDistinct, public Query $query)

Parameters

$nullsDistinctbool|nullWhether NULLS DISTINCT (true) or NULLS NOT DISTINCT (false) is written, or null when neither is
$queryQueryThe query inside the parentheses
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the query and reports the predicate.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes UNIQUE, the NULLS treatment and the query in parentheses.

Parameters

$outOutput
Test cases 1
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 2

Relations§

Instantiated in 1
Type checks 1