This project is archived and is in readonly mode.
Arel gives invalid SQL for empty array
Reported by Troels Petersen | January 17th, 2010 @ 08:19 PM | in 3.0.2
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 ()))
Comments and changes to this ticket
-
José Valim January 17th, 2010 @ 10:20 PM
- Assigned user set to Pratik
-
José Valim January 18th, 2010 @ 08:02 PM
- Milestone cleared.
-
Emilio Tagua March 12th, 2010 @ 07:34 PM
- State changed from new to invalid
This is fixed in master, feel to re-open it if you can reproduce the problem.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>