final class UtilityOption
    implements Clause
    uses Snapshot
Public API: explicitly declared with @visibility public.

One option of EXPLAIN, VACUUM, ANALYZE, CLUSTER or REINDEX: a name and an optional value.

Mirrors PostgreSQL's DefElem of utility_option_elem. The grammar accepts any word as the name and a word, a string, a number or nothing as the value; the command decides which names it knows. A name is a word, or one of the keywords the grammar reads on their own; the keyword FORMAT is read only directly before the word json. Source: https://www.postgresql.org/docs/17/sql-explain.html, https://www.postgresql.org/docs/17/sql-vacuum.html.

Reading an option and its valuedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('VACUUM (PARALLEL 2, ANALYSE)');
    [$operation->statement->options[0]->option(), $operation->statement->options[0]->argument->magnitude->digits, $operation->statement->options[1]->option()] // => ['parallel', '2', 'analyze']
Refusing the FORMAT keyword before another value than jsondoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\UtilityOption(\SqlSemantics\Platform\PostgreSql\Statement\Utility\Maintenance\OptionKeyword::Format) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public Word|StringConstant|Toggle|SignedNumber|null $argument = null

Methods§

public function __construct(
    public Name|OptionKeyword $name,
    public Word|StringConstant|Toggle|SignedNumber|null $argument = null,
)

Parameters

$nameName|OptionKeywordThe option name: a word, or a keyword the grammar reads on its own
$argumentWord|StringConstant|Toggle|SignedNumber|nullThe value, when one is written: a word, a string, TRUE, FALSE or ON, or a number
Calls 2
public function option(): string

Answers the option name as the command receives it.

Returns

string
Test cases 2
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the value.

Parameters

$derivationDerivation
$environmentEnvironment
public function render(Output $out): void

Writes the name and the value; the word format before the word json is quoted so that it is not read as the keyword.

Parameters

$outOutput
Calls 5
public function text(): ?string

Answers the value as the text the command receives, or null when no value is written.

Returns

?string
Test cases 1

Test cases 10§

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 8

Relations§

Instantiated in 3
Constant reads 5
Type declarations 6