This project is archived and is in readonly mode.

#3727 ✓invalid
Troels Petersen

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

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>

Tags

Pages