Backticks wrapping SQL values in polymorphic associations...

It's not normal - backticks are for quoting column or table names and so on, whereas this is just a string. I've seen another email or thing on irc about this. It would be great to get to the bottom of it.


Wait: is what you're saying here is that MySQL supports (in various versions) either backticks or single-quotes for identifiers? I thought the SQL standard was to use double-quotes for identifiers, single-quotes for string literals.

Michael Glaesemann grzm seespotcode net

Identifiers are things such as table and column names, rather than literal strings or language keywords like CREATE or TABLE. My understanding is the MySQL uses backticks to quote identifiers. (Not having used MySQL, I can only speak from what I've seen. As I mentioned before, the SQL standard specifies that double-quotes should be used for identifiers.)

Actually, I think you've misidentified where the problem occurs. If there is a problem in the ActiveRecord code, I expect the error is somewhere in the code for polymorphic association, possibly calling quote_column_name when it shouldn't. The quote_column_name method in and of itself appears to be doing exactly what it should.

The first thing I'd check I think is to see if there's any MySQL-specific polymorphic attribute code. From there I'd look in ActiveRecord itself.

Have you tried this in edge?

Michael Glaesemann grzm seespotcode net