rails/rails — pull request #5900 by amatsuda (2012-04-19 13:17:57+00:00)
Title: current MySQL driver fails to fetch PK name when the PK has USING option

Given the following MySQL table (you know we sometimes should unfortunately work on some legacy DB or non-Rails DB like this):

```SQL```
CREATE TABLE `btree_pk_tables` (
`id` int(11) NOT NULL auto_increment,
PRIMARY KEY USING BTREE (`id`)
)
```

`BtreePkTable.primary_key` becomes `nil` because of Regexp bug.
Attached a patch with test cases. Tested on MySQL 5.1, Ruby 1.9.3.

Because this bug happens on current stable version of AR, I hope this to be backported to 3-2-stable branch. I confirmed that the Regexp works either on Ruby 1.9 and Ruby 1.8.7, so it should work.