final class AlterSequence
    implements Statement, Relation
    uses Snapshot
Public API: explicitly declared with @visibility public.

A request to change the options of a sequence.

Mirrors PostgreSQL's AlterSeqStmt (sequence, options, missing_ok). The sequence is resolved (PG- TABLE-TARGET-001) and is the relation fact of the statement; the statement changes no declaration. A relation declared as another kind is reported: "t" is not a sequence in PostgreSQL 16, cannot open relation "t" in PostgreSQL 17 (PG-RELATION-KIND-001). Source: https://www.postgresql.org/docs/17/sql-altersequence.html.

Changing a sequencedoctest
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER SEQUENCE IF EXISTS s RESTART WITH 1 NO MAXVALUE');
    $statement->toString() // => 'ALTER SEQUENCE IF EXISTS s RESTART 1 NO MAXVALUE'

Properties§

public non-empty-list<SequenceOption> $options
public bool $ifExists = false

Methods§

public function __construct(
    public QualifiedName $name,
    list<SequenceOption> $options,
    public bool $ifExists = false,
)

Parameters

$nameQualifiedNameThe sequence
$optionslist<SequenceOption>The options in the order written
$ifExistsboolWhether IF EXISTS is written
Calls 2
public function deriveStatement(Derivation $derivation): void
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Resolves the sequence and answers its facts.

Parameters

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

Writes the statement.

Parameters

$outOutput
Calls 5

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 declarations 1