I had a strange error when saving the settings for the search_api saved_searches module, where metatags was trying to:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'entity_type' at row 1: INSERT INTO {metatag} (entity_type, entity_id, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => search_api_saved_searches_settings [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => a:0:{} ) in metatag_metatags_save() (line 308 of /var/www7/sites/all/modules/metatag/metatag.module).
"search_api_saved_searches_settings" is obviously longer than the current 32 characters, which was creating the error. I had to increase the size of the entity_type field to be able to save my form.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | metatag-n1504182-2.patch | 921 bytes | damienmckenna |
Comments
Comment #1
damienmckennaDrupal 7 core uses a VARCHAR(128) column to store the entity_type, so Metatags should do likewise.
Comment #2
damienmckennaThis patch expands the column to VARCHAR(128), as described above.
Comment #3
dave reidNo, this is incorrect. Entity type is in fact limited to 32 characters. See #1191434: Standardize entity type is a maximum of 32 characters (not 64 or 128). We should also probably *not* save a record if the metatags array is empty instead.
Comment #4
damienmckennaDave, I don't think we can say "entity_type is 32 characters" until Drupal core's inconsistency is fixed via that issue, until then we need to postpone this.
Comment #5
dave reidWell the simple fact is that for any fieldable entities you are in fact limited to 32 characters otherwise you are not able to add fields on those entity types since saving to field_config_instance will fail.
Comment #6
dave reidIssues that are postponed cannot be a release blocker.
Comment #7
damienmckennaDave's rationale in #5 above should suffice.