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

COMMENT ON kind object IS 'text' | NULL: sets or removes the comment of an object.

Mirrors PostgreSQL's CommentStmt. NULL, like an empty string, removes the comment. A commented relation or column is resolved. Source: https://www.postgresql.org/docs/17/sql-comment.html.

Reading a comment on a columndoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("COMMENT ON COLUMN t.a IS 'key'");
    [$operation->statement->kind->value, $operation->statement->comment?->value] // => ['COLUMN', 'key']

Properties§

public ObjectKind $kind
public StringConstant|null $comment

Methods§

public function __construct(
    public ObjectKind $kind,
    public ObjectReference $object,
    public StringConstant|null $comment,
)

Parameters

$kindObjectKindThe kind of the object
$objectObjectReferenceThe object, named as COMMENT names objects of the kind
$commentStringConstant|nullThe comment; null for NULL
Calls 5
public function deriveStatement(Derivation $derivation): void

Derives the object.

Parameters

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

Writes the statement.

Parameters

$outOutput
Calls 4

Test cases 3§

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

Dedicated tests 2
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Type declarations 1