Class: Gitlab::Database::AsWithMaterialized

Inherits:
Arel::Nodes::As
  • Object
show all
Defined in:
lib/gitlab/database/as_with_materialized.rb

Overview

This class is a special Arel node which allows optionally define the ‘MATERIALIZED` keyword for CTE and Recursive CTE queries.

Constant Summary collapse

MATERIALIZED =
'MATERIALIZED '

Instance Method Summary collapse

Constructor Details

#initialize(left, right, materialized: true) ⇒ AsWithMaterialized

Returns a new instance of AsWithMaterialized.



9
10
11
12
13
14
15
# File 'lib/gitlab/database/as_with_materialized.rb', line 9

def initialize(left, right, materialized: true)
  if materialized
    right.prepend(MATERIALIZED)
  end

  super(left, right)
end