Found via a webform issue. π Out of memory because of too large library definitions Needs work .
Webform has a feature where you can add CSS or JavaScript in the webform config entity.
I tried to add an entity query to filter webforms by whether they have anything in those keys prior to them being loaded. One of webform's test modules has a long string in that key.
The way that the config entity key_store collection works is that the collection is the config entity type, the key value is the config key + value together (which has to fit in a 128 varchar), and the value is the config entity ID.
With that MR, running tests ends up with the following failure:
Webform Cards Toggle Java Script (Drupal\Tests\webform_cards\FunctionalJavascript\WebformCardsToggleJavaScript)
β Toggle
β
β Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1: INSERT INTO "test96496449key_value" ("name", "collection", "value") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array
β (
β [:db_insert_placeholder_0] => javascript:(function ($, Drupal, once) {
β
β 'use strict';
β
β Drupal.behaviors.webformCardsTestJavaScript = {
β attach(context) {
β var $forms = $(context).is('form.webform-submission-form')
β ? $(context)
β : $('form.webform-submission-form', context);
β
β $(once('webform-cards-test-javascript', $forms))
β .on('webform_cards:change', function (event, $activeCard) {
β console.log('webform_cards:change');
β console.log(event);
β console.log($activeCard);
β });
β }
β };
β
β })(jQuery, Drupal, once);
β
β [:db_insert_placeholder_1] => config.entity.key_store.webform
β [:db_insert_placeholder_2] => a:1:{i:0;s:37:"webform.webform.test_cards_javascript";}
β )
β
One possible option would be to pre-truncate the string before it goes to the database. For the webform use case, we only need to know if the value is not-empty, not do an exact string comparison.
If that's not acceptable, then we should probably valid the length and throw a clear exception - however if so that seriously limits the options for optimizing the webform case.
Active
11.0 π₯
configuration entity system