classIndexInference
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.
$insert = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('INSERT INTO t VALUES (1) ON CONFLICT (a) DO NOTHING');
count($insert->statement->conflict->target->elements) // => 1new \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Conflict\IndexInference([]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public non-empty-list<Clause> $elementspublic Scalar|null $where = nullMethods§
public function __construct(list<Clause> $elements, public Scalar|null $where = null)Parameters
$elements | list<Clause> | The index columns and expressions, in order; at least one |
$where | Scalar|null | The predicate of the partial unique indexes inferred |
Throws
InvalidConstruction When there is no elementCalls 2
- static-call Check::listOf() line 46
- class-const Clause::class() line 46
public function render(Output $out): voidWrites the parenthesized elements and the predicate.
Parameters
$out | Output |
Calls 2
- method-call Output::symbol() line 54
- method-call Output::keyword() line 56
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
IndexInferenceTestcalls
Relations§
Instantiated in 1
Type checks 1
Type declarations 3
- type SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:203
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Conflict\ConflictDoNothing packages/sql-semantics-postgres/src/Statement/Manipulation/Conflict/ConflictDoNothing.php:30
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Conflict\ConflictDoUpdate packages/sql-semantics-postgres/src/Statement/Manipulation/Conflict/ConflictDoUpdate.php:48