ON DUPLICATE KEY UPDATE fails
-
I have a problem, where SQLite Integration seems not to detect an ‘ON DUPLICATE KEY UPDATE’ correctly and tries to write an INSERT instead of UPDATE statement.
Anybody out there knows how to fix that?
Here’s the error thrown:
Cannot add/save table row; SQL: INSERT INTO
wp_pods_testpod
(id
,name
,permalink
,modified
) VALUES ( 1, ‘1e’, ‘1e’, ‘2016-01-09 17:05:23’ ) ON DUPLICATE KEY UPDATEid
= VALUES(id
),name
= VALUES(name
),permalink
= VALUES(permalink
),modified
= VALUES(modified
); Response:Queries made or created this session were
Raw query: INSERT INTOwp_pods_testpod
(id
,name
,permalink
,modified
) VALUES ( 1, ‘1e’, ‘1e’, ‘2016-01-09 17:05:23’ ) ON DUPLICATE KEY UPDATEid
= VALUES(id
),name
= VALUES(name
),permalink
= VALUES(permalink
),modified
= VALUES(modified
)
Rewritten: INSERT INTO wp_pods_testpod ( id, name, permalink, modified ) VALUES ( 1, ‘1e’, ‘1e’, ‘2016-01-09 17:05:23’ )
With Placeholders: INSERT INTO wp_pods_testpod ( id, name, permalink, modified ) VALUES ( 1, :param_0 , :param_1 , :param_2 )
Prepare: INSERT INTO wp_pods_testpod ( id, name, permalink, modified ) VALUES ( 1, :param_0 , :param_1 , :param_2 )
Executing: array ( 0 => ‘1e’, 1 => ‘1e’, 2 => ‘2016-01-09 17:05:23’, )
Error occurred at line 692 in Function execute_query.Error occurred at line 692 in Function execute_query.
Error message was: Error while executing query! Error message was: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: wp_pods_testpod.id
- The topic ‘ON DUPLICATE KEY UPDATE fails’ is closed to new replies.