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

SET [LOCAL] parameter TO value [, ...]: a request to change a configuration parameter.

Rule: PG-SET-001. Mirrors PostgreSQL's VariableSetStmt of kind VAR_SET_VALUE: the parameter, the values in order (a list-valued parameter takes several) and whether the change lasts for the current transaction only. TO and = are the same request, and SESSION states the default duration; neither is kept. The same structure is the SET clause of a routine, a role, a database and ALTER SYSTEM. Facts: none; the values are words, strings and numbers the parameter interprets when the command runs. Source: https://www.postgresql.org/docs/17/sql-set.html. Status: Implemented.

Reading a SET with several valuesdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SET LOCAL search_path = app, 'Public'");
    [$operation->statement->parameter->text(), count($operation->statement->values), $operation->toString()] // => ['search_path', 2, "SET LOCAL search_path TO app, 'Public'"]
Refusing a SET without a valuedoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Session\SetParameter(new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Session\ParameterName([new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a')]), []) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public non-empty-list<OptionArgument> $values
public ParameterName $parameter
public bool $local = false

Methods§

public function __construct(
    public ParameterName $parameter,
    list<OptionArgument> $values,
    public bool $local = false,
)

Parameters

$parameterParameterNameThe parameter
$valueslist<OptionArgument>The values in order; at least one
$localboolWhether the change lasts for the current transaction only
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives the values; a configuration parameter is not part of a declaration context.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 2

Test cases 2§

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 1

Relations§

Instantiated in 1
Type declarations 2