classAlterSequence
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.
$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> $optionspublic QualifiedName $namepublic bool $ifExists = falseMethods§
public function __construct(
public QualifiedName $name,
list<SequenceOption> $options,
public bool $ifExists = false,
)Parameters
$name | QualifiedName | The sequence |
$options | list<SequenceOption> | The options in the order written |
$ifExists | bool | Whether IF EXISTS is written |
Calls 2
- static-call Check::listOf() line 55
- class-const SequenceOption::class() line 55
public function deriveStatement(Derivation $derivation): voidResolves the sequence and derives the options.
Parameters
$derivation | Derivation |
Calls 11
- new RelationKinds line 63
- method-call RelationKinds::of() line 64
- method-call Derivation::relation() line 64
- method-call Derivation::environment() line 64
- method-call RelationKinds::require() line 65
- class-const RelationKind::Sequence() line 65
- class-const GrammarRelease::PostgreSql166() line 65
- class-const KindRule::NotSequence() line 65
- class-const KindRule::OpenSequence() line 65
- method-call Sequences::options() line 66
- new Sequences line 66
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactResolves the sequence and answers its facts.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 2
- method-call Targets::existing() line 74
- new Targets line 74
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 5
- method-call Output::keyword() line 82
- method-call Spelling::qualified() line 86
- new Spelling line 86
- method-call Writing::sequence() line 87
- new Writing line 87
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.