Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit c7427602 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Ignore eager loading in UNION

The queries that are UNION'd together don't need any eager loading
(since we really only use the resulting SQL instead of having
ActiveRecord actually run the queries). By dropping any eager loaded
associations queries such as the following work instead of producing a
SQL error:

parent fa85a92ddaaa
......@@ -286,7 +286,14 @@ def search(query)
# We explicitly remove any eager loading clauses as they're:
# 1. Not needed by this query
# 2. Combined with .joins(:namespace) lead to all columns from the
# projects & namespaces tables being selected, leading to a SQL error
# due to the columns of all UNION'd queries no longer being the same.
namespaces = select(:id).
......@@ -634,6 +634,12 @@
it 'returns projects with a matching namespace name regardless of the casing' do
expect( eq([project])
it 'returns projects when eager loading namespaces' do
relation = described_class.all.includes(:namespace)
expect( eq([project])
describe '#rename_repo' do
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment