Closed smcyr closed 2 years ago
This also happens in Craft 3.7.x. I've just had this twice in the last 10 minutes when quick-saving while writing an article.
Same as @darylknight, I just faced that exact error on a 3.7.40.1
install.
We encounter similar issues in Craft 3.7.42 and are able te reproduce it in a fresh install of Craft.
This error occurs in a very specific situation.
Needed to reproduce: Craft version: 3.7.42 Plugins: Vizy (1.0.13)
What we did: 1: Create a second website in /admin/settins/sites, so we have 2 websites. 2: Create a file volume, we need that to upload images. 2: Create a text field, file field, and a vizy field (with previously created text and file field (or any other)). 3: Create a new single and set as homepage. 4: Assign Vizy field and image field to this single (in this order: Vizy / Text / File ) 5: Try adding Content (in every field). -> wait when draft is saved 6: Save entry.
The error enclosed will occur,
What you can do to not show this error is one of the following:
autosaveDrafts
to false
in config fileWe're also seeing this issue. Craft version - 3.7.40
It only occurs with a specific entry type. All other entry types save without throwing this error.
The error thrown.
Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`klr_prod`.`changedfields`, CONSTRAINT `changedfields_elementId_fk` FOREIGN KEY (`elementId`) REFERENCES `elements` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
The SQL being executed was: INSERT INTO `changedfields` (`dateUpdated`, `propagated`, `userId`, `elementId`, `siteId`, `fieldId`) VALUES ('2022-05-19 17:56:21', 0, 1, 167141, 1, 78) ON DUPLICATE KEY UPDATE `dateUpdated`='2022-05-19 17:56:21', `propagated`=0, `userId`=1 in /home/forge/kahnlitwin.com/vendor/yiisoft/yii2/db/Schema.php:67
If I hit the back button and reload the entry edit screen I see the "Entry Saved" cp message and the data I've edited has been saved.
@JohnCBent that sounds more like #11083, which was fixed in 3.7.41.
I’m seeing the same errors when saving entries with 3.7.42.
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
DB
.craft_changedfields
, CONSTRAINTcraft_changedfields_elementId_fk
FOREIGN KEY (elementId
) REFERENCEScraft_elements
(id
) ON DELETE CASCADE ON UPDATE CASCADE)
Plugin info below in case that’s useful.
Thanks all! Just released Craft 3.7.43 and 4.0.3 with a fix for this.
What happened?
Description
When I have an entry with a couple of simple fields. Sometimes, when I save rapidly at the same time as the automatic saving (which happens often for me when I save with ctrl+s), I get this error:
If I reload the page and save again, it works fine.
Craft CMS version
4.0.2
PHP version
8.0.18
Operating system and version
Windows 11
Database type and version
MariaDB 10.6.5
Image driver and version
GD 8.0.18
Installed plugins and versions
No response