Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9873e2b1
Commit
9873e2b1
authored
Feb 12, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
e3fea40f
1319a9ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
lib/gitlab/sql/recursive_cte.rb
lib/gitlab/sql/recursive_cte.rb
+1
-1
spec/lib/gitlab/sql/recursive_cte_spec.rb
spec/lib/gitlab/sql/recursive_cte_spec.rb
+9
-0
No files found.
lib/gitlab/sql/recursive_cte.rb
View file @
9873e2b1
...
...
@@ -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
...
...
spec/lib/gitlab/sql/recursive_cte_spec.rb
View file @
9873e2b1
...
...
@@ -31,6 +31,15 @@ describe Gitlab::SQL::RecursiveCTE, :postgresql do
expect
(
cte
.
alias_to
(
table
).
to_sql
).
to
eq
(
"
#{
source_name
}
AS
#{
alias_name
}
"
)
end
it
'replaces dots with an underscore'
do
table
=
Arel
::
Table
.
new
(
'gitlab.kittens'
)
source_name
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
:cte_name
)
alias_name
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
:gitlab_kittens
)
expect
(
cte
.
alias_to
(
table
).
to_sql
).
to
eq
(
"
#{
source_name
}
AS
#{
alias_name
}
"
)
end
end
describe
'#apply_to'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment