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

One ON UPDATE or ON DELETE clause of a foreign key.

Mirrors fk_upd_action/fk_del_action with fk_del_set_cols: SET NULL and SET DEFAULT may name the columns they set. The server accepts such a column list only for ON DELETE, which is a diagnostic of the constraint. Source: https://www.postgresql.org/docs/17/sql-createtable.html#SQL-CREATETABLE-PARMS-REFERENCES.

Reading the columns SET NULL setsdoctest
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int, b int, FOREIGN KEY (a, b) REFERENCES u ON DELETE SET NULL (b))');
    $create->statement->definition->elements[2]->actions[0]->columns[0]->value // => 'b'
Refusing a column list for an action that sets nothingdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Constraint\Reference\ReferentialAction(\SqlSemantics\Platform\PostgreSql\Statement\Constraint\Reference\ReferenceEvent::Delete, \SqlSemantics\Platform\PostgreSql\Statement\Constraint\Reference\ReferenceAction::Cascade, [new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a')]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Name> $columns

Methods§

public function __construct(
    public ReferenceEvent $event,
    public ReferenceAction $action,
    list<Name> $columns = [],
)

Parameters

$eventReferenceEventThe change answered
$actionReferenceActionThe action taken
$columnslist<Name>The columns SET NULL or SET DEFAULT sets
Calls 4
public function render(Output $out): void

Writes ON, the event, the action and its columns.

Parameters

$outOutput
Calls 4

Test cases 2§

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 1

Relations§

Instantiated in 1
Constant reads 1
Type declarations 1