MySQL 版本 8.0.28 的 ForeignKeyFailedException 中未显示外键名称

Foreign key name is not showing in ForeignKeyFailedException in MySQL version 8.0.28

提问人:HARISH 提问时间:3/7/2023 最后编辑:HARISH 更新时间:3/7/2023 访问量:57

问:

我的代码抛出外键异常。 MySQL 8.0.12显示完整的异常消息(带有外键名称),但是当我升级到MySQL到8.0.28时,它没有显示完整的异常消息。

MySQL 8.0.12 中的异常:

Exceptions.ForeignKeyFailedException: Upsert failed as some referenced entity doesnt exist. ---> MySql.Data.MySqlClient.MySqlException: Cannot add or update a child row: a foreign key constraint fails (`SchemaName`.`table name`, CONSTRAINT `foreign key name` FOREIGN KEY (`column`) REFERENCES `table name` (`column`) ON UPDATE CASCADE)

MySQL 8.0.28 中的异常:

Exceptions.ForeignKeyFailedException: Upsert failed as some referenced entity doesnt exist. ---> MySql.Data.MySqlClient.MySqlException: Cannot add or update a child row: a foreign key constraint fails

如何在 MySQL 8.0.28 或更高版本中显示完整的异常消息?

mysql 外键

评论

0赞 P.Salmon 3/7/2023
这不是我期望从mysql mysql获得的错误消息,您还标记了c#和 vb.net 那么在哪里看到错误?..您也可以单独在 mysql 中测试此过程,以排除 in/out mysql 的不完整性。将表定义和 ALTER 语句发布为文本会有所帮助

答: 暂无答案