MySQL - 錯誤代碼及解決思路

11 月 8, 2023

--

#1217 - Cannot delete or update a parent row: a foreign key constraint fails

該 table 有被其他 table 設定關聯,必須先刪除被使用的關聯 FK 才能繼續

--

#1486 - Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed

分區 RANGE 使用 year() 這類時間函式時不能使用 timestamp 資料類型,timestamp 可以使用 UNIX_TIMESTAMP()

可以參考:MySQL Partitioning 分區

--

#1503 - A UNIQUE INDEX must include all columns in the table's partitioning function

分區必須要包含所有唯一的索引值,例如以下要建立 create_time 的分區就會發生錯誤

--

 1,220 total views,  7 views today

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。