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

The action INSERT ... VALUES of a MERGE WHEN clause: one row is inserted from the source row.

Mirrors a MergeWhenClause with CMD_INSERT, its column list, override and values. A value may be DEFAULT. Source: https://www.postgresql.org/docs/17/sql-merge.html.

Reading an insert actiondoctest
$merge = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('MERGE INTO t USING u ON t.a = u.a WHEN NOT MATCHED THEN INSERT (a) OVERRIDING USER VALUE VALUES (u.a)');
    [count($merge->statement->clauses[0]->action->values), $merge->toString()] // => [1, 'MERGE INTO t USING u ON t.a = u.a WHEN NOT MATCHED THEN INSERT (a) OVERRIDING USER VALUE VALUES (u.a)']
Refusing an insert without valuedoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge\MergeInsert([], null, []) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<ColumnTarget> $columns
public non-empty-list<Scalar> $values
public Overriding|null $overriding

Methods§

public function __construct(
    list<ColumnTarget> $columns,
    public Overriding|null $overriding,
    list<Scalar> $values,
)

Parameters

$columnslist<ColumnTarget>The column list in written order
$overridingOverriding|nullWhose values identity columns receive
$valueslist<Scalar>The values in written order; at least one

Throws

InvalidConstruction When there is no value, or a list holds a foreign item
Calls 3
public function render(Output $out): void

Writes INSERT, the columns, the override and VALUES.

Parameters

$outOutput
Calls 2

Test cases 3§

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 2

Relations§

Instantiated in 4
Type checks 2
Type declarations 2