Commit 944dd9af authored by Adam Hegyi's avatar Adam Hegyi

Fix CTE test with PG12

This change fixes the failing test case with PG12
parent 35bd91b7
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::SQL::CTE do RSpec.describe Gitlab::SQL::CTE do
describe '#to_arel' do describe '#to_arel' do
it 'generates an Arel relation for the CTE body', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/325916' do it 'generates an Arel relation for the CTE body' do
relation = User.where(id: 1) relation = User.where(id: 1)
cte = described_class.new(:cte_name, relation) cte = described_class.new(:cte_name, relation)
sql = cte.to_arel.to_sql sql = cte.to_arel.to_sql
...@@ -14,7 +14,14 @@ RSpec.describe Gitlab::SQL::CTE do ...@@ -14,7 +14,14 @@ RSpec.describe Gitlab::SQL::CTE do
relation.except(:order).to_sql relation.except(:order).to_sql
end end
expect(sql).to eq("#{name} AS (#{sql1})") expected = [
"#{name} AS ",
Gitlab::Database::AsWithMaterialized.materialized_if_supported,
(' ' unless Gitlab::Database::AsWithMaterialized.materialized_if_supported.blank?),
"(#{sql1})"
].join
expect(sql).to eq(expected)
end end
end end
......
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