[MDEV-9009] SERIAL datatype creates UNIQUE KEY Created: 2015-10-25 Updated: 2016-07-13 Due: 2016-06-29 Resolved: 2016-07-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Minor |
| Reporter: | Michaël de groot | Assignee: | Sergei Golubchik |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, Currently the SERIAL data type makes a unique key. I assume Galera does not consider the first unique key to be the primary key (like InnoDB does). In this perspective it may make sense to let SERIAL create a primary key instead of unique key. Perhaps only when Galera is loaded, for backwards compatibility. Interesting in your insights about this issue, |
| Comments |
| Comment by Sergei Golubchik [ 2015-11-02 ] |
|
The server automatically promotes the first UNIQUE NOT NULL index to PRIMARY. So do all engines to match the server behavior. Are you saying that galera doesn't do that? |
| Comment by Michaël de groot [ 2016-05-24 ] |
|
serg sorry for the late reply. I do not expect it to cause problems, but it does not show up like that in the information_schema tables, this causes problems with monitoring. If it's not too much work I think we should change the behavior of SERIAL data type. |
| Comment by Sergei Golubchik [ 2016-05-25 ] |
|
But it has nothing to do with SERIAL. The first unique not null index is always promoted to be the primary key, unless you have declared a PRIMARY KEY explicitly. But this is an internal change. Showing it in information schema tables would mean a silent automatic table metadata change from the user point of view, and it will also cause problems with monitoring. |