Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/sql/cte.rb
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'lib/gitlab/sql/cte.rb')
-rw-r--r--lib/gitlab/sql/cte.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/sql/cte.rb b/lib/gitlab/sql/cte.rb
index 8f37602aeaa..67f61e0db40 100644
--- a/lib/gitlab/sql/cte.rb
+++ b/lib/gitlab/sql/cte.rb
@@ -33,7 +33,7 @@ module Gitlab
# Returns the Arel relation for this CTE.
def to_arel
- sql = Arel::Nodes::SqlLiteral.new("(#{query.to_sql})")
+ sql = Arel::Nodes::SqlLiteral.new("(#{query_as_sql})")
Gitlab::Database::AsWithMaterialized.new(table, sql, materialized: @materialized)
end
@@ -54,6 +54,12 @@ module Gitlab
.with(to_arel)
.from(alias_to(relation.model.arel_table))
end
+
+ private
+
+ def query_as_sql
+ query.is_a?(String) ? query : query.to_sql
+ end
end
end
end