aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/visitors/to_sql.rb4
-rw-r--r--test/visitors/test_to_sql.rb11
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 5319aeb418..73319364d5 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -142,6 +142,10 @@ key on UpdateManager using UpdateManager#key=
'DISTINCT'
end
+ def visit_Arel_Nodes_DistinctOn o
+ raise NotImplementedError, 'DISTINCT ON not implemented for this db'
+ end
+
def visit_Arel_Nodes_With o
"WITH #{o.children.map { |x| visit x }.join(', ')}"
end
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 25ff7be3e2..1d5f89280b 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -299,6 +299,17 @@ module Arel
}
end
end
+
+ describe 'distinct on' do
+ it 'raises not implemented error' do
+ core = Arel::Nodes::SelectCore.new
+ core.set_quantifier = Arel::Nodes::DistinctOn.new(Arel.sql('aaron'))
+
+ assert_raises(NotImplementedError) do
+ @visitor.accept(core)
+ end
+ end
+ end
end
end
end