diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/visitors/postgresql.rb | 21 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb index 49f7482e7d..60878ddd20 100644 --- a/lib/arel/visitors/postgresql.rb +++ b/lib/arel/visitors/postgresql.rb @@ -3,24 +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_Regexp o - "#{visit o.left} ~ #{visit o.right}" + def visit_Arel_Nodes_Regexp o, collector + infix_value o, collector, ' ~ ' end - def visit_Arel_Nodes_NotRegexp o - "#{visit o.left} !~ #{visit o.right}" + def visit_Arel_Nodes_NotRegexp o, collector + infix_value o, collector, ' !~ ' end - def visit_Arel_Nodes_DistinctOn o - "DISTINCT ON ( #{visit o.expr} )" + def visit_Arel_Nodes_DistinctOn o, collector + collector << "DISTINCT ON ( " + visit(o.expr, collector) << " )" end end end diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 0dbec61212..8e254d504b 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -275,8 +275,8 @@ module Arel visit o.expr end - def visit_Arel_Nodes_Distinct o - DISTINCT + def visit_Arel_Nodes_Distinct o, collector + collector << DISTINCT end def visit_Arel_Nodes_DistinctOn o, collector |