classSequenceReference
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.
$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 $ownedpublic DottedName $nameMethods§
public function __construct(public bool $owned, public DottedName $name)Parameters
$owned | bool | Whether the option is OWNED BY; SEQUENCE NAME otherwise |
$name | DottedName | The object named |
public function deriveClause(Derivation $derivation, Environment $environment): voidReports 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
$derivation | Derivation | |
$environment | Environment |
Calls 11
- function-call
countline 50 - method-call DottedName::qualified() line 50
- new DottedName line 50
- function-call
array_sliceline 50 - new RelationKinds line 52
- method-call RelationKinds::require() line 53
- method-call RelationKinds::declared() line 53
- class-const RelationKind::BaseTable() line 53
- class-const RelationKind::ForeignTable() line 53
- class-const RelationKind::View() line 53
- class-const KindRule::SequenceOwner() line 53
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
SequenceReferenceTestcalls