interface Modification
    extends Statement, Query
Public API: explicitly declared with @visibility public.

A data-modifying statement: INSERT, UPDATE, DELETE or MERGE.

Each is a statement and also a query whose rows are those of its RETURNING list, without columns when it has none, so that it can be the body of a common table expression, the query of a prepared statement or of COPY, or a statement nested in another one. Deriving it as a query (Derivation::query()) derives every part against the given outer environment and records no root output; deriving it as a statement records its RETURNING rows as the output of the root. Source: https://www.postgresql.org/docs/17/queries-with.html#QUERIES-WITH-MODIFYING.

Telling whether a statement returns rowsdoctest
$semantics = new \SqlSemantics\Platform\PostgreSql\Semantics();
    [$semantics->analyze('DELETE FROM t')->statement->returnsRows(), $semantics->analyze('DELETE FROM t RETURNING *')->statement->returnsRows()] // => [false, true]

Methods§

public function returnsRows(): bool

Tells whether the statement returns rows: whether it has a RETURNING list.

Returns

bool
Called from 1
public function commonTables(): ?CommonTables

Answers the WITH clause written before the statement, or null.

Returns

Called from 1

Test cases 7§

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

Dedicated tests 1
Other tests reaching this symbol 6

Relations§

Implemented by 6
Method calls 2
Type checks 10
Type declarations 1