primary key

BubikolRamios's profile image BubikolRamios posted 12 years ago in General Permalink
http://dev.mysql.com/doc/refman/5.1/en/create-table.html:
A PRIMARY KEY is a unique index where all key columns must be defined as NOT NULL. If they are not explicitly declared as NOT NULL, MySQL declares them so implicitly (and silently).


Some kind of warning, mybe, would be appropriate if one creates a primary key with nullable columns.

Even if you have a checkmark on 'allow null' on field inside index, it will create primery key without any warning.
Code modification/commit from ansgar.becker, 12 years ago, revision 7.0.0.4191
Do not allow NULL, and force NOT NULL, on primary key columns. See http://www.heidisql.com/forum.php?t=11156
ansgar's profile image ansgar posted 12 years ago Permalink
Can confirm that. r4191 removes the checkable checkbox for primary key columns, and forces the column to be NOT NULL.
ansgar's profile image ansgar posted 12 years ago Permalink
As an addition, r4192 displays not applicable table attributes with a disabled checkbox, where Heidi displayed no checkbox at all previously. Makes it more clear for the user I think:
1 attachment(s):
  • table-editor-disabled-checkboxes

Please login to leave a reply, or register at first.