From 62207faee92c820da9fbc9cc6fe785461c2d826b Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 13 Jun 2012 20:09:40 -0300 Subject: Do not generate NOT IN (NULL) when empty right --- lib/arel/visitors/to_sql.rb | 2 +- test/visitors/test_to_sql.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index a6be451e6f..cb8df8329a 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -467,7 +467,7 @@ key on UpdateManager using UpdateManager#key= alias :visit_Arel_Nodes_Division :visit_Arel_Nodes_InfixOperation def visit_Array o - o.empty? ? 'NULL' : o.map { |x| visit x }.join(', ') + o.map { |x| visit x }.join(', ') end def quote value, column = nil diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index f832bdf925..58eec1f63b 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -167,10 +167,10 @@ module Arel } end - it "should turn empty right to NULL" do + it "should return IN () when empty right which is invalid SQL" do node = @attr.in [] @visitor.accept(node).must_be_like %{ - "users"."id" IN (NULL) + "users"."id" IN () } end @@ -255,10 +255,10 @@ module Arel } end - it "should turn empty right to NULL" do + it "should return NOT IN () when empty right which is invalid SQL" do node = @attr.not_in [] @visitor.accept(node).must_be_like %{ - "users"."id" NOT IN (NULL) + "users"."id" NOT IN () } end -- cgit v1.2.3