Fix retrieving duplicated columns with mysql

This fixes SQL queries with MySQL where the same name is used several times for the same column, therefore [breaking the build](https://travis-ci.org/rails/rails/jobs/15329752#L1172).

When a field is named several times, second and further occurencies get prepended the name "_x" where x is the index.