-- Nullable column doesn't cause automatic primary key
MariaDB [mw]> create table t1 (a int);
Query OK, 0 rows affected (0.02 sec)
MariaDB [mw]> create unique index t1a on t1 (a);
Query OK, 0 rows affected (0.06 sec)
MariaDB [mw]> select * from information_schema.innodb_sys_indexes, information_schema.innodb_sys_tables where innodb_sys_tables.table_id=innodb_sys_indexes.table_id and innodb_sys_tables.name='t1';
MariaDB [mw]> select * from information_schema.innodb_sys_indexes, information_schema.innodb_sys_tables where innodb_sys_tables.table_id=innodb_sys_indexes.table_id and innodb_sys_tables.name='t2';
MariaDB [mw]> create table t3 (a int not null, unique key (a));
Query OK, 0 rows affected (0.02 sec)
MariaDB [mw]> select * from information_schema.innodb_sys_indexes, information_schema.innodb_sys_tables where innodb_sys_tables.table_id=innodb_sys_indexes.table_id and innodb_sys_tables.name='t3';