aboutsummaryrefslogblamecommitdiffstats
path: root/lib/arel/visitors/postgresql.rb
blob: 60878ddd2006fd3d58af9982d9d1535acf2a8987 (plain) (tree)
1
2
3
4
5
6
7
8
9


                                            
             
 

                                               

         

                                                    

         

                                              

         

                                                 

         


                                                  
         


       
module Arel
  module Visitors
    class PostgreSQL < Arel::Visitors::ToSql
      private

      def visit_Arel_Nodes_Matches o, collector
        infix_value o, collector, ' ILIKE '
      end

      def visit_Arel_Nodes_DoesNotMatch o, collector
        infix_value o, collector, ' NOT ILIKE '
      end

      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
end