I'd be interested in hearing thoughts about changing the generated SQL for 
a negated equality comparison from using "!=" to "IS DISTINCT FROM" (where 
supported), since the latter has less-surprising handling of NULL values.

For example, with the following bit of AR:

User.where.not(parent_id: 10)

You would get some SQL roughly equivalent to:

WHERE parent_id != 10

But this would not return rows where parent_id is NULL, since a comparison 
against NULL always returns NULL.  This SQL would behave as we'd expect:

WHERE parent_id IS DISTINCT FROM 10

Would there be any disadvantages to doing this sort of comparison by 
default?

J

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to