Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Arel gives invalid SQL for empty array

#3727

ActiveRecord <= 2.3 accepts an empty array as a condition on an attribute, but Arel turns it into invalid SQL:

User.all( :conditions => { :id => [] } )

ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1: SELECT * FROM users WHERE ((users.id IN ()))

Reported by Troels Petersen · January 17th, 2010 @ 08:19 PM

State: invalid
Milestone: 3.0.2
Assigned to: Pratik Pratik
Importance: Low

Activity

  1. José Valim
    José Valim
    • Assigned user set to Pratik

    January 17th, 2010 @ 10:20 PM

  2. José Valim
  3. Emilio Tagua
    Emilio Tagua
    • State changed from new to invalid

    This is fixed in master, feel to re-open it if you can reproduce the problem.

    March 12th, 2010 @ 07:34 PM

  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM