-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Description
One of the errors that is coming up quite often is a result of a user trying a failed update for a second time and running into this sql error
2022-02-25T07:30:46+00:00 INFO 80.244.198.253 update Ran query from file 4.0.0-2018-05-15. Query text: CREATE TABLE IF NOT EXISTS `#__workflows` ( `id` int NOT NULL AUTO_INCREMENT, .
2022-02-25T07:30:46+00:00 INFO 80.244.198.253 update Ran query from file 4.0.0-2018-05-15. Query text: INSERT INTO `#__workflows` (`id`, `asset_id`, `published`, `title`, `description.
2022-02-25T07:30:46+00:00 INFO 80.244.198.253 update JInstaller: :Install: Error SQL Duplicate entry '1' for key 'PRIMARY
There are several options available to us to resolve by amending the query "insert into ..."
In our specific case the most relevant would appear to be changing the query to "replace into ..."
When issuing a REPLACE statement, there are two possible outcomes for each issued command:
- No existing data row is found with matching values and thus a standard INSERT statement is performed.
- A matching data row is found, causing that existing row to be deleted with the standard DELETE statement, then a normal INSERT is performed afterward.
@richard67 thoughts? You know way more than me on sql