Skip to content

invalid queries being generated in tests #63

xxx opened this Issue Feb 13, 2013 · 3 comments

2 participants

xxx commented Feb 13, 2013

After updating today to gem v. 0.2.1, we're getting a number of failures in our test suite, all around SELECT/DELETE IN queries where an empty array is passed in, e.g.:

Campaign.where(:entity_id => [])

generates SELECT "campaigns".* FROM "campaigns" WHERE "campaigns"."entity_id" IN (), which is a syntax error. This only occurs in our test suite as far as we can tell. When running within a rails console, the generated query is SELECT "campaigns".* FROM "campaigns" WHERE "campaigns"."entity_id" IN (NULL), which is expected.

Removing the postgres_ext gem from the bundle resolves this issue completely, with no other changes.

@danmcclain danmcclain added a commit that referenced this issue Feb 14, 2013
@danmcclain danmcclain Fixes bad monkey patch of array visitor
Closes issue #63

Thanks for finding this issue, it was a bad monkey patch on my part. I didn't copy the original code verbatim, and missed the case of an empty array. Spec added to prevent this from happening again

@danmcclain danmcclain closed this Feb 14, 2013

Released 0.2.2 which has this issue patched

xxx commented Feb 14, 2013

confirmed fixed. <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.