# Getting weird warnings on mysql upgrade checker 8.4 "references a non unique key"

**URL:** <https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406>\
**Category:** Percona Server for MySQL 8.0\
**Created:** [June 23, 2025, 2:12pm UTC](https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406 "2025-06-23T14:12:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [June 23, 2025, 2:12pm UTC](https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406/1 "2025-06-23T14:12:31Z")

</div>

Hi,  
Getting a weird warning when running the mysql upgrade checker to 8.4  
I’m getting several errors on foreign keys referencing a primary key on a single table.

alfresco\_up.fk\_alf\_store\_root - invalid foreign key defined as  
‘alf\_store(root\_node\_id)’ references a non unique key at table ‘alf\_node’.  
alfresco\_up.fk\_alf\_sub\_node - invalid foreign key defined as  
‘alf\_subscriptions(node\_id)’ references a non unique key at table ‘alf\_node’.  
alfresco\_up.fk\_alf\_sub\_user - invalid foreign key defined as  
‘alf\_subscriptions(user\_node\_id)’ references a non unique key at table  
‘alf\_node’.  
alfresco\_up.fk\_alf\_usaged\_n - invalid foreign key defined as  
‘alf\_usage\_delta(node\_id)’ references a non unique key at table ‘alf\_node’.

Solutions:

- Convert non unique key to unique key if values do not have any duplicates.  
In case of foreign keys involving partial columns of key, create composite  
unique key containing all the referencing columns if values do not have any  
duplicates.

- Remove foreign keys referring to non unique key/partial columns of key.

- In case of multi level references which involves more than two tables  
change foreign key reference.

Column being referenced is a primary key and therefore should be unique by default.  
I also checked if there were actual duplicates somehow on the column being referenced but they are all unique.  
Column name is “id”  
table create statement is as follows:  
| alf\_node | CREATE TABLE `alf_node` (  
`id` bigint NOT NULL AUTO\_INCREMENT,  
`version` bigint NOT NULL,  
`store_id` bigint NOT NULL,  
`uuid` varchar(36) NOT NULL,  
`transaction_id` bigint NOT NULL,  
`type_qname_id` bigint NOT NULL,  
`locale_id` bigint NOT NULL,  
`acl_id` bigint DEFAULT NULL,  
`audit_creator` varchar(255) DEFAULT NULL,  
`audit_created` varchar(30) DEFAULT NULL,  
`audit_modifier` varchar(255) DEFAULT NULL,  
`audit_modified` varchar(30) DEFAULT NULL,  
`audit_accessed` varchar(30) DEFAULT NULL,  
PRIMARY KEY (`id`),  
UNIQUE KEY `store_id` (`store_id`,`uuid`),  
KEY `idx_alf_node_txn_type` (`transaction_id`,`type_qname_id`),  
KEY `fk_alf_node_acl` (`acl_id`),  
KEY `fk_alf_node_store` (`store_id`),  
KEY `idx_alf_node_tqn` (`type_qname_id`,`store_id`,`id`),  
KEY `fk_alf_node_loc` (`locale_id`),  
KEY `idx_alf_node_mdq` (`store_id`,`type_qname_id`),  
KEY `idx_alf_node_cor` (`audit_creator`,`store_id`,`type_qname_id`),  
KEY `idx_alf_node_crd` (`audit_created`,`store_id`,`type_qname_id`),  
KEY `idx_alf_node_mor` (`audit_modifier`,`store_id`,`type_qname_id`),  
KEY `idx_alf_node_mod` (`audit_modified`,`store_id`,`type_qname_id`),  
CONSTRAINT `fk_alf_node_acl` FOREIGN KEY (`acl_id`) REFERENCES `alf_access_control_list` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,  
CONSTRAINT `fk_alf_node_loc` FOREIGN KEY (`locale_id`) REFERENCES `alf_locale` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,  
CONSTRAINT `fk_alf_node_store` FOREIGN KEY (`store_id`) REFERENCES `alf_store` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,  
CONSTRAINT `fk_alf_node_tqn` FOREIGN KEY (`type_qname_id`) REFERENCES `alf_qname` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,  
CONSTRAINT `fk_alf_node_txn` FOREIGN KEY (`transaction_id`) REFERENCES `alf_transaction` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT  
) ENGINE=InnoDB AUTO\_INCREMENT=215405 DEFAULT CHARSET=utf8 |

---

<div class="post-metadata">

**Author:** ![yunus.uyanik](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/yunus.uyanik/32/19250_2.png) [@yunus.uyanik](https://forums.percona.com/u/yunus.uyanik)\
**Post date:** [June 23, 2025, 4:01pm UTC](https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406/2 "2025-06-23T16:01:35Z")

</div>

Hi,  
The warnings you getting because of the introduction of **restrict\_fk\_on\_non\_standard\_key** in 8.4. This variable by default is enabled so it disallows the FK creation which reference only part of a composite key or non-unique.  
Have you checked the relational tables?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [June 23, 2025, 8:22pm UTC](https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406/3 "2025-06-23T20:22:49Z")

</div>

Hi @ipcmlr,  
There’s lots of bad practices in your schema design. For starters, using BIGINT everywhere wastes 4 bytes per column, per record if you are storing numbers less than 4B. Integers in MySQL always use the full storage. Second, instead of uuid as char, store uuid as binary(16) and save 1/2 the space. Use the native `UUID_TO_BIN` function. I also see lots of repeated columns in your indexes. Investigate if you are indeed using all of those indexes. Remember that WHERE clause makes no difference to the index order. Ex: WHERE a = 4 AND b = 2 is the same thing as WHERE b = 2 AND a = 4. The index (a, b) will be used for both queries.

---

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [July 23, 2025, 1:17pm UTC](https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406/4 "2025-07-23T13:17:07Z")

</div>

I could not find any issues with the keys.  
I updated the mysql shell from 8.4.1 to 8.4.6 and now it doesnt show the error.  
It is very strange.  
I was also getting some weird error last time that upgrade to 8.4.1 was not supported for my version but now using 8.4.6 it works.  
Not sure what is going on.

1. Checks for foreign keys not referencing a full unique index  
(foreignKeyReferences)  
No issues found

Edit:  
Both percona mysql shell 8.4.5 and generic mysql shell 8.4.6 show none of the errors that were in the earlier 8.4.1 version.

---

<div class="post-metadata">

**Author:** ![Abhinav\_Gupta](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/abhinav_gupta/32/6262_2.png) [@Abhinav\_Gupta](https://forums.percona.com/u/Abhinav_Gupta)\
**Post date:** [July 23, 2025, 2:24pm UTC](https://forums.percona.com/t/getting-weird-warnings-on-mysql-upgrade-checker-8-4-references-a-non-unique-key/38406/5 "2025-07-23T14:24:38Z")

</div>

A couple of bugs related to keys were fixed after the 8.4.1 MySQL shell releases, so always ensure that you test it with the latest available MySQL shell release versions.

- [The upgrade checker utility returned a false positive for foreign keys defined on tables in the Cluster metadata schema. (Bug #36975599)](https://dev.mysql.com/doc/relnotes/mysql-shell/8.4/en/news-8-4-3.html)
- [The Upgrade Checker utility returned a false positive for partial keys in schemas referencing full keys in other schemas. (Bug #37651453)](https://dev.mysql.com/doc/relnotes/mysql-shell/8.4/en/news-8-4-6.html) \<====
