sqlite 更新出错原因分析
UPDATE vehicle_infos SET vehicle_id = 'CHERY', vehicle_name = 'CHERY', vehicle_version = 'V2.01.001', serial_num = 'G0090e2000016', language = 'en', release_date = 1634215017000, download_date = 1635413729261, file_path='D:' WHERE vehicle_id = 'CHERY' AND special_function_id = '' AND language = 'en'
设置的主键为:
"PRIMARY KEY": vehicle_id,vehicle_version,serial_num,language,file_path
所以执行更新会报错:
UNIQUE constraint failed: vehicle_infos.vehicle_id, vehicle_infos.vehicle_version, vehicle_infos.serial_num, vehicle_infos.language, vehicle_infos.file_path Unable to fetch row
因为查询出两条数据,执行sql语句后会导致两条数据相同,然而主键时不允许出现两条相同数据,故报错误
|