No constraint and index names

It appears that the constraint name reported under INFORMATION_SCHEMA.TABLE_CONSTRAINTS.CONSTRAINT_NAME is always ‘PRIMARY’ for every primary key constraint, regardless of what name was specified in the CREATE TABLE DDL. The same goes for the corresponding index reported in INFORMATION_SCHEMA.STATISTICS.INDEX_NAME.

Note that for unique constraints and foreign key constraints this is not the case.

I was also a bit surprised that both for reference and sharded tables every primary key index always appears twice in INFORMATION_SCHEMA.STATISTICS. Once with INDEX_TYPE ‘BTREE’ and once with ‘SHARD’. But this is maybe to be expected.

Can you give an example of the syntax you used to create the table with the named primary key constraint?

I assume like this?

create table s(a int, constraint foobar primary key(a));

Yes, like that. But I have noticed that MySQL has the same behavior here (unlike many other RDBMS implementations, however). So from that standpoint it can be considered consistent.