classSetParameter
final class SetParameter
implements Statement
uses Snapshot
@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.
$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'"]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\InvalidConstructionProperties§
public non-empty-list<OptionArgument> $valuespublic ParameterName $parameterpublic bool $local = falseMethods§
public function __construct(
public ParameterName $parameter,
list<OptionArgument> $values,
public bool $local = false,
)Parameters
$parameter | ParameterName | The parameter |
$values | list<OptionArgument> | The values in order; at least one |
$local | bool | Whether the change lasts for the current transaction only |
Calls 2
- static-call Check::listOf() line 49
- class-const OptionArgument::class() line 49
public function deriveStatement(Derivation $derivation): voidDerives the values; a configuration parameter is not part of a declaration context.
Parameters
$derivation | Derivation |
Calls 1
- method-call Derivation::environment() line 58
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 67
- method-call Output::node() line 71
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
- type SqlSemantics\Platform\PostgreSql\Lowering\Utility\SettingRule packages/sql-semantics-postgres/src/Lowering/Utility/SettingRule.php:181
- type SqlSemantics\Platform\PostgreSql\Statement\Utility\Session\AlterSystemSetting packages/sql-semantics-postgres/src/Statement/Utility/Session/AlterSystemSetting.php:39