Mysql connector choosing wrong table index

Hi,

I’ve connected NoCoDb to an external mysql database, but it seems to be using the wrong field as the identifier. The table looks like this:

mysql> describe customers;
+----------------------+--------------+------+-----+---------------------+-----------------------------+
| Field                | Type         | Null | Key | Default             | Extra                       |
+----------------------+--------------+------+-----+---------------------+-----------------------------+
| id                   | int(10)      | NO   | PRI | NULL                | auto_increment              |
| cid                  | char(11)     | YES  |     | NULL                |                             |
| first_name           | char(20)     | YES  |     | NULL                |                             |
| last_name            | char(20)     | YES  |     | NULL                |                             |
| address              | char(20)     | YES  |     | NULL                |                             |
| city                 | char(20)     | YES  |     | NULL                |                             |
| state                | char(2)      | YES  |     | NULL                |                             |
| zip                  | char(5)      | YES  |     | NULL                |                             |

But NoCoDb is picking the cid field as the index where id is clearly the correct choice. How can I fix this?

Mike.

Hi @Thud1415,

I guess you are expecting first column on table as identifier which is display field (Display value | NocoDB)

Are you able to update records without problem? If so we are definitely recognizing PK properly.
We mark PK as system field so it will not be shown on UI by default, in order to see it you can enable Show System Fields (Hide & reorder fields | NocoDB)

Please let me know if that resolve your problem. If it persist lets follow up further to fix it for you.

1 Like

First off, I wanted to thank you for your prompt reply.

I was testing with data that I couldn’t afford to have corrupted, so I connected in read-only mode. After your reply, I connected to a less important database and you were completely correct!

The PK had been hidden from me, and I assumed that the first column was being used (incorrectly) as the index.

Thanks again,

Mike.

1 Like