count vs size on ActiveRecord select queriesI stumbled on this bit of weirdness when using the SQL query
User.select(:id, :name, :email).count. It threw a
User.select(:id, :name, :email).sizeworked instead.
Out of curiosity, I did some digging. According the the ActiveRecord docs,
not all valid select expressions are valid count expressions. TheI also stumbled on an issue on rails Github issues page about this, and a very helpful comment from rafaelfranca explained that I can also use
specifics differ between databases. In invalid cases, an error from
the database is thrown.