Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 执行LOAD DATA语句,如果指定 REPLACE INTO,当发生主键冲突时报错

[TiDB Usage Environment] Production Environment / Testing
[TiDB Version] v6.5
[Reproduction Path]
- Execute the SQL statement: LOAD DATA LOCAL INFILE ‘B_PRODCONSTI.csv’ REPLACE INTO TABLE B_PRODCONSTI FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘"’ LINES TERMINATED BY ‘\n’ IGNORE 1 LINES (TENANT, PRODUID, CONSTIPRODUID, CAMOUNT, STATE, UPTIME)
- If the imported data has the same primary key, the following error will occur:
assertion failed: key: 748000000000001d9d5f72010031003900370030ff0033003400350000fd060a00800000025b, assertion: NotExist, start_ts: 441033509315805186, existing start ts: 441033501700259844, existing commit ts: 441033501713629190 - If there is no primary key conflict, or if IGNORE INTO is used instead of REPLACE INTO, there will be no issue.