classSetExpression
final class SetExpression
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ALTER [ COLUMN ] ... SET EXPRESSION AS ( expression ): replaces the expression of a generated column.
Mirrors AT_SetExpression (PostgreSQL 17). The expression is derived where the columns of the relation are visible. Source: https://www.postgresql.org/docs/17/sql-altertable.html.
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER TABLE t ALTER b SET EXPRESSION AS (a * 2)');
$statement->toString() // => 'ALTER TABLE t ALTER b SET EXPRESSION AS (a * 2)'Properties§
public Name $columnpublic Scalar $expressionMethods§
public function __construct(public Name $column, public Scalar $expression)Parameters
$column | Name | The column |
$expression | Scalar | The generation expression |
public function deriveClause(Derivation $derivation, Environment $environment): voidChecks that the column exists and derives the expression against the relation.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 5
- method-call Alterations::column() line 46
- new Alterations line 46
- method-call Derivation::scalar() line 47
- method-call GeneratedColumns::expression() line 48
- new GeneratedColumns line 48
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
SetExpressionTestcalls
Relations§
Instantiated in 1
Type checks 3
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\AlterKinds::other() packages/sql-semantics-postgres/src/Rules/Table/Command/AlterKinds.php:161
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::check() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:53
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::rule() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:78