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
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-02-11 22:36:57 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-02-11 23:06:54 +0300
commit9100ca188c45f2129d5e891534ed38718ef67e46 (patch)
tree69d9c170947fc4c2e3f1009386ec1762a5024509 /lib
parenta1215556ec6c5ab84862519b82cee99645dad357 (diff)
Replace dots with an underscore when creating an alias for the CTE
When the Arel table to use as the alias contains a schema in your name, e.g., "gitlab_secondary"."namespaces" it produces an invalid query.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/sql/recursive_cte.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/sql/recursive_cte.rb b/lib/gitlab/sql/recursive_cte.rb
index ec1f00a3a91..e45ac5d4765 100644
--- a/lib/gitlab/sql/recursive_cte.rb
+++ b/lib/gitlab/sql/recursive_cte.rb
@@ -48,7 +48,7 @@ module Gitlab
#
# alias_table - The Arel table to use as the alias.
def alias_to(alias_table)
- Arel::Nodes::As.new(table, alias_table)
+ Arel::Nodes::As.new(table, Arel::Table.new(alias_table.name.tr('.', '_')))
end
# Applies the CTE to the given relation, returning a new one that will