super-table: SQL Error - Integrity constraint violation: 1062 Duplicate entry when propagating entries to new site

I have several entry types that use a few different Super Table fields. I’m in the process of adding a new site to our config (making it now a multi-site config). When I add the site in Craft, and then edit an entry type that has a ST field to enable the entries for the new site, a job is queued up for propagation as expected. But it will fail with an SQL error.

An example:

  1. We have an entry type for Dealers. There is an ST field in that entry type.
  2. We add the new site, then edit the Entry type for “Dealer Entries”, to enable the entries for this new site.
  3. The “Resaving Dealer Entries entries” job is create and fails almost immediately, with the error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '567638' for key 'craft_supertablecontent_showroompics_elementId_locale_unq_idx' The SQL being executed was: INSERT INTO `craft_stc_showroompics` (`elementId`, `siteId`, `field_showroomPicCropZoomLevel`, `dateCreated`, `dateUpdated`, `uid`) VALUES (567638, 2, '1.0', '2021-04-20 18:10:27', '2021-04-20 18:10:27', 'b03e8e7a-1cc4-4f74-9111-c59e5b5740a9')

image

I’ve tried the following:

  1. Running both “Check Content Tables” and “Re-save Super Table Fields” in admin/super-table/settings.
  2. Re-saving the entries before adding the new site.

Steps to reproduce

  1. Add a new site
  2. Edit an entry type with a Super Table field to enable it for the new site.

Additional info

  • Plugin version: 2.6.7
  • Craft version: 3.6.12
  • Multi-site: Yes

Additional context I believe this sort of thing happens with any entry type that has a ST field on it (of note: these are NOT fields that are part of a Matrix field)

I believe these super table fields that are causing the error were created before we migrated to Craft 3 a couple years ago, if that helps.

Happy to give any additional info if needed. Thanks

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (18 by maintainers)

Most upvoted comments

@chadwells Have just reviewed and merged this PR, should be in the next release.