aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors/postgresql.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/visitors/postgresql.rb')
-rw-r--r--lib/arel/visitors/postgresql.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb
index 2a935e4318..047f71aaa6 100644
--- a/lib/arel/visitors/postgresql.rb
+++ b/lib/arel/visitors/postgresql.rb
@@ -5,6 +5,7 @@ module Arel
CUBE = 'CUBE'
ROLLUP = 'ROLLUP'
GROUPING_SET = 'GROUPING SET'
+ LATERAL = 'LATERAL'
private
@@ -69,6 +70,23 @@ module Arel
grouping_array_or_grouping_element o, collector
end
+ def visit_Arel_Nodes_Lateral o, collector
+ collector << LATERAL
+ collector << SPACE
+ grouping_parentheses o, collector
+ end
+
+ # Used by Lateral visitor to enclose select queries in parentheses
+ def grouping_parentheses o, collector
+ if o.expr.is_a? Nodes::SelectStatement
+ collector << "("
+ visit o.expr, collector
+ collector << ")"
+ else
+ visit o.expr, collector
+ end
+ end
+
# Utilized by GroupingSet, Cube & RollUp visitors to
# handle grouping aggregation semantics
def grouping_array_or_grouping_element o, collector