Closed Tigrov closed 7 months ago
There are two problems when update table using expressions:
Expression::$params
ExpressionInterface
$values = ['abc']; $command->update( 'table_name, [ 'values' => new Expression( 'ARRAY(SELECT DISTINCT UNNEST("values" || :values))', ['values' => new ArrayExpression($values, 'varchar(126)')] ), ], '"values" && :values', ['values' => new ArrayExpression($values, 'varchar(126)')] )->execute();
UPDATE "table_name" SET "values"=ARRAY(SELECT DISTINCT UNNEST("values" || ARRAY[:qp1]::varchar(126)[])) WHERE "values" && ARRAY[:qp2]::varchar(126)[]
$params === [ ':qp1' => 'abc', ':qp2' => 'abc', ];
UPDATE "table_name" SET "values"=ARRAY(SELECT DISTINCT UNNEST("values" || :values)) WHERE "values" && :values
$params === [ ':values' => ArrayExpression, ];
There are two problems when update table using expressions:
Expression::$params
are not passed in the query.Expression::$params
have anExpressionInterface
inside, it is not processedExpected query
Actual query