>> 
>> If WHERE (defects.org IN ('NULL')) select the string literal 'NULL', 
>> then the data selected is wrong, no?
>> 
>> I would expect
>> #<Defect id: 1, org: "NULL", created_at: "2010-10-04 00:14:20", 
>> updated_at:
>> "2010-10-04 00:14:20>
>> 
>> but instead, I actually get
>> 
>> #<Defect id: 1, org: nil, created_at: "2010-10-04 00:14:20", updated_at:
>> "2010-10-04 00:14:20>
>> 
>> (org is string data type).
> 
> Hmm.  I wonder if JavaDB stores null values as the literal "NULL", or if 
> the Ruby/JavaDB adaptor is at fault.
> 
> In either case, your database (or its adaptor) is doing something silly 
> (in that there is apparently no way to distinguish between NULL and 
> "NULL"), and you should certainly not rely on this silliness.
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]

I set up a test using sql3lite & mysql. Both responded the same way.

Look like 'NULL' in the IN clause is a reserve word. For a string 
literal NULL, you'll have to quote it.

So WHERE (defects.org IN ('NULL')) selects nil

and WHERE (defects.org in ('"NULL"')) select the literal "NULL".
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to