final class IndexInference
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The conflict target ( index_column_or_expression, ... ) [ WHERE predicate ] that infers the unique indexes ON CONFLICT arbitrates on.

Mirrors PostgreSQL's InferClause with indexElems and whereClause. The elements and the predicate see the target table only. Source: https://www.postgresql.org/docs/17/sql-insert.html#SQL-ON-CONFLICT.

Reading the inferred index columnsdoctest
$insert = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('INSERT INTO t VALUES (1) ON CONFLICT (a) DO NOTHING');
    count($insert->statement->conflict->target->elements) // => 1
Refusing an empty list of index elementsdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Conflict\IndexInference([]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public non-empty-list<Clause> $elements
public Scalar|null $where = null

Methods§

public function __construct(list<Clause> $elements, public Scalar|null $where = null)

Parameters

$elementslist<Clause>The index columns and expressions, in order; at least one
$whereScalar|nullThe predicate of the partial unique indexes inferred

Throws

InvalidConstruction When there is no element
Calls 2
public function render(Output $out): void

Writes the parenthesized elements and the predicate.

Parameters

$outOutput
Calls 2

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 1
Type checks 1
Type declarations 3