TIL: The SQL-92 spec dictates that CHAR/VARCHAR comparisons be made after padding each string with spaces to the same length.
That means that using a standard MySQL collation, the two strings 'foo' and 'foo ' are equal. (ref: https://mariadb.com/kb/en/22-sql-collations-collation/) The problem (which just bit me after all these years) is essentially: > query_name = 'foo' > Thing.create(:name => 'foo ') > thing = Thing.where(:name => query_name).first # returns created thing > thing.name == query_name # => false ## ouch That result seems to violate the POLS to me, but I'd like to hear any opinions about if and/or where this behavior should be fixed before I start working on a patch to the MySQL2 gem :-) -- Hassan Schroeder ------------------------ [email protected] http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAULGhUDK1NS9BS4Kja%2B7RM6j7bUtH0rVC_7hUbBLCgiQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

