diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-07 11:46:58 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 22:49:41 +0200 |
commit | 530cf2a2669ea1ee3c41d48a15919f875babefa4 (patch) | |
tree | 1074edcc5f2dd8aa6d7840d2430f52793de7790c /lib | |
parent | 438a0773dc850d3fa690881ea0b022bc27435e1e (diff) | |
download | gitlab-ce-530cf2a2669ea1ee3c41d48a15919f875babefa4.tar.gz |
Don't break when building unions on empty collections
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/sql/union.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/sql/union.rb b/lib/gitlab/sql/union.rb index f30c771837a..c99b262f1ca 100644 --- a/lib/gitlab/sql/union.rb +++ b/lib/gitlab/sql/union.rb @@ -26,7 +26,11 @@ module Gitlab @relations.map { |rel| rel.reorder(nil).to_sql }.reject(&:blank?) end - fragments.join("\n#{union_keyword}\n") + if fragments.any? + fragments.join("\n#{union_keyword}\n") + else + 'NULL' + end end def union_keyword |