This project is archived and is in readonly mode.

#6133 new
Mat Schaffer

Empty array interpolates as NULL in where condition

Reported by Mat Schaffer | December 8th, 2010 @ 04:12 PM

This works fine:

Comment.where("id NOT IN (?)", [1,2,3])

But passed an empty array like so:

Comment.where("id NOT IN (?)", [])

Generates this query which doesn't have the intended effect of including all records:

SELECT "comments".* FROM "comments" WHERE (id NOT IN (NULL))

Seems like empty arrays should interpolate as an empty string rather than NULL.

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>

Shared Ticket Bins

Pages