final class SequenceReference
    implements SequenceOption
    uses Snapshot
Public API: explicitly declared with @visibility public.

A sequence option that names an object: OWNED BY a column (or NONE) or SEQUENCE NAME.

OWNED BY NONE is the name none, as the server reads it. SEQUENCE NAME is meant for the sequence of an identity column; the server rejects it in CREATE SEQUENCE and ALTER SEQUENCE. Source: https://www.postgresql.org/docs/17/sql-createsequence.html.

Reading the owner of a sequencedoctest
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE SEQUENCE s OWNED BY t.id');
    [$create->statement->options[0]->owned, $create->statement->options[0]->name->last()->value] // => [true, 'id']

Properties§

public bool $owned
public DottedName $name

Methods§

public function __construct(public bool $owned, public DottedName $name)

Parameters

$ownedboolWhether the option is OWNED BY; SEQUENCE NAME otherwise
$nameDottedNameThe object named
public function deriveClause(Derivation $derivation, Environment $environment): void

Reports an OWNED BY column whose relation is declared as a kind that cannot own a sequence.

The server looks the names up itself; only a table, a foreign table or a view can own a sequence (process_owned_by, PG-RELATION-KIND-001).

Parameters

$derivationDerivation
$environmentEnvironment
Calls 11
public function render(Output $out): void

Writes the keywords and the name.

Parameters

$outOutput
Calls 1

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 2
Type checks 1