I have a Recipe content type that uses a multi-value field for ingredients lists. I was testing doing a search and replace on "avocado." This is the field content before:

multi-value field values before

and the field content after:

multi-value field values after

and the error that I received upon performing the search/replace:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_ingredients_value' at row 1: INSERT INTO "node__field_ingredients" ("entity_id", "revision_id", "bundle", "delta", "langcode", "field_ingredients_value") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 250016 [:db_insert_placeholder_1] => 2070781 [:db_insert_placeholder_2] => recipe [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => 6 medium sweet potatoes, 2 scallions, sliced thin, 1 cup shredded part-skim mozzarella or dairy-free mozzarella style shreds, 1 cup canned black beans, drained, rinsed, 2 tbsp. Parmesan, grated, or dairy-free Parmesan or nutritional yeast, 1/2 avocadoo, peeled, pitted, and diced, 1/2 cup salsa verde, Extra virgin olive oil ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveToDedicatedTables() (line 1403 of /var/www/html/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Issue fork scanner-3462717

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bhogue created an issue. See original summary.

bhogue’s picture

Issue summary: View changes
anybody’s picture

Version: 8.x-1.0-rc7 » 8.x-1.x-dev
Priority: Normal » Major

Definitely a major issue, thanks for the report! @bhogue could you create a MR with a fix maybe?

bhogue’s picture

Sorry, @anybody, I don't have the expertise to provide a fix for this particular issue.

smustgrave’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
damienmckenna’s picture

Priority: Major » Critical
Parent issue: » #3577750: Plan for Scanner 2.0.0

Data corruption is a critical problem we must fix before releasing a stable v2 version.

damienmckenna’s picture

Issue tags: +Needs tests

It would help to add test coverage for this.

damienmckenna’s picture

Assigned: Unassigned » damienmckenna

I'm working on this.

damienmckenna’s picture

I've added test coverage for multi-value fields, and sure enough the test fails. That's kinda catastrophic.

damienmckenna’s picture

damienmckenna’s picture

Title: Individual field values from multi-value field are combined into one value on replace » Node logic only processes first value, looses other values in multi-value text fields
Status: Active » Needs work

Clarifying the problem.

damienmckenna’s picture

This also affects the search logic, it only checks the first value in in multi-value fields.

  • damienmckenna committed 49be591f on 2.0.x
    Issue #3462717 by DamienMcKenna: Fixed multi-value text field search,...
damienmckenna’s picture

Status: Needs work » Fixed

This has been fixed for text fields, but work needs to be done to make the solution generic so that all field types work correctly; there will be work done to make v2.0 reliable, stay tuned for more.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

damienmckenna’s picture

Assigned: damienmckenna » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.