Quoting Jeffrey L. Taylor <r...@abluz.dyndns.org>: > > I am switching to a composite primary key (string and user ID) from the Rails > conventional auto-incrementing integer primary ID. The table is large (2.5 > million records) and I'd rather not discard the contents. The > composite_primary_key gem doesn't appear to support altering the table with a > migration to do its magic, only creating a table from scratch. So I dumped > the table with mysqldump, ran the migration (table looks good), and am trying > to repopulate the table. It has accented characters and is complaining about > duplicates, apparently around words with and without accents, e.g., 'jose' and > 'josé'. I've been deleting one by hand from the dump, but it is tedious and > very slow. Emacs crawls when dealing with very large files with very long > lines. > > I just don't understand why the accents are causing problems. The string > column is utf8_general_ci collation, just like other fields in the database > with strings with accents. What do I need to specify so it will import the > dump? Is there a problem with strings with accents in composite indexes? >
The answer is mixed and bits of it don't make sense. If I work with the MySQL client (mysql), I can create records with primary keys identical, except for an accent. Doing the same thing in the Rails console throws an DuplicateKey exception. Using mysqldump to dump the contents of a table, changing the table so the primary key is a integer-string composite and trying to repopulate the table from the mysqldump output also barfs on a duplicate key exception. It is non-optimal, but I can live for the moment with a table with two non-unique indexes. Jeffrey --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---