Commit 226c4abb authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '325916-fix-failing-test-with-pg12' into 'master'

Fix CTE test with PG12 [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!57461
parents 549ea1d9 944dd9af
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::SQL::CTE 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)
cte = described_class.new(:cte_name, relation)
sql = cte.to_arel.to_sql
......@@ -14,7 +14,14 @@ RSpec.describe Gitlab::SQL::CTE do
relation.except(:order).to_sql
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
......
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