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

DROP kind [IF EXISTS] object, ... [CASCADE | RESTRICT]: removes catalog objects of one kind.

Mirrors PostgreSQL's DropStmt (removeType, objects, behavior, missing_ok, concurrent), which also represents DROP FUNCTION, AGGREGATE, OPERATOR, OPERATOR CLASS and FAMILY, CAST and TRANSFORM. How the objects are named depends on the kind exactly as the grammar writes it (PG-OBJECT-FORM-001). A dropped relation is resolved; dropping changes no declaration of the context. Source: https://www.postgresql.org/docs/17/sql-droptable.html, https://www.postgresql.org/docs/17/sql-dropfunction.html.

Reading the dropped tablesdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('DROP TABLE IF EXISTS a, b CASCADE');
    [$operation->statement->kind->value, count($operation->statement->objects), $operation->statement->ifExists] // => ['TABLE', 2, true]

Properties§

public non-empty-list<ObjectReference> $objects
public ObjectKind $kind
public bool $ifExists = false
public DropBehavior|null $behavior = null
public bool $concurrently = false

Methods§

public function __construct(
    public ObjectKind $kind,
    list<ObjectReference> $objects,
    public bool $ifExists = false,
    public DropBehavior|null $behavior = null,
    public bool $concurrently = false,
)

Parameters

$kindObjectKindThe kind of the objects
$objectslist<ObjectReference>The objects, named as DROP names objects of the kind; one only for the kinds named within a table, operator classes and families, casts and transforms
$ifExistsboolWhether IF EXISTS is written
$behaviorDropBehavior|nullCASCADE or RESTRICT, if written
$concurrentlyboolWhether CONCURRENTLY is written; for indexes only
Calls 10
public function deriveStatement(Derivation $derivation): void

Derives the objects and reports concurrent drops the server rejects.

Parameters

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

Writes the statement.

Parameters

$outOutput
Calls 4

Test cases 10§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 5

Relations§

Instantiated in 5
Type declarations 2