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.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb
index 812710181c..60878ddd20 100644
--- a/lib/arel/visitors/postgresql.rb
+++ b/lib/arel/visitors/postgresql.rb
@@ -3,16 +3,25 @@ module Arel
class PostgreSQL < Arel::Visitors::ToSql
private
- def visit_Arel_Nodes_Matches o
- "#{visit o.left} ILIKE #{visit o.right}"
+ def visit_Arel_Nodes_Matches o, collector
+ infix_value o, collector, ' ILIKE '
end
- def visit_Arel_Nodes_DoesNotMatch o
- "#{visit o.left} NOT ILIKE #{visit o.right}"
+ def visit_Arel_Nodes_DoesNotMatch o, collector
+ infix_value o, collector, ' NOT ILIKE '
end
- def visit_Arel_Nodes_DistinctOn o
- "DISTINCT ON ( #{visit o.expr} )"
+ def visit_Arel_Nodes_Regexp o, collector
+ infix_value o, collector, ' ~ '
+ end
+
+ def visit_Arel_Nodes_NotRegexp o, collector
+ infix_value o, collector, ' !~ '
+ end
+
+ def visit_Arel_Nodes_DistinctOn o, collector
+ collector << "DISTINCT ON ( "
+ visit(o.expr, collector) << " )"
end
end
end