diff --git a/CHANGELOG.md b/CHANGELOG.md index 283f3a3c..12140e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.0.2 under development -- no changes in this release. +- Bug #278: Remove `RECURSIVE` expression from CTE queries (@Tigrov) ## 1.0.1 July 24, 2023 diff --git a/src/DQLQueryBuilder.php b/src/DQLQueryBuilder.php index e9b37507..cd91f722 100644 --- a/src/DQLQueryBuilder.php +++ b/src/DQLQueryBuilder.php @@ -9,6 +9,7 @@ use Yiisoft\Db\Expression\ExpressionInterface; use Yiisoft\Db\Mssql\Builder\InConditionBuilder; use Yiisoft\Db\Mssql\Builder\LikeConditionBuilder; +use Yiisoft\Db\Query\Query; use Yiisoft\Db\QueryBuilder\AbstractDQLQueryBuilder; use Yiisoft\Db\QueryBuilder\Condition\InCondition; use Yiisoft\Db\QueryBuilder\Condition\LikeCondition; @@ -109,4 +110,14 @@ protected function extractAlias(string $table): array|bool return parent::extractAlias($table); } + + public function buildWithQueries(array $withs, array &$params): string + { + /** @psalm-var array{query:string|Query, alias:ExpressionInterface|string, recursive:bool}[] $withs */ + foreach ($withs as &$with) { + $with['recursive'] = false; + } + + return parent::buildWithQueries($withs, $params); + } }