Attempt to update field json medium failed: Exception thrown while performing a schema update. SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL, PRIMARY KEY (`entity_id`, `deleted`, `delta`, `langcode`), INDEX `bu' at line 8: CREATE TABLE {node__field_json_medium} ( `bundle` VARCHAR(128) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance', `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT 'A boolean indicating whether this data item has been deleted', `entity_id` INT unsigned NOT NULL COMMENT 'The entity id this data is attached to', `revision_id` INT unsigned NOT NULL COMMENT 'The entity revision id this data is attached to', `langcode` VARCHAR(32) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'The language code for this data item.', `delta` INT unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields', `field_json_medium_value` NOT NULL, PRIMARY KEY (`entity_id`, `deleted`, `delta`, `langcode`), INDEX `bundle` (`bundle`), INDEX `revision_id` (`revision_id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Data storage for node field field_json_medium.'; Array ( ) .

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tbfisher created an issue. See original summary.

brianfisher’s picture

-

brianfisher’s picture

actually, changing the default max size to any value other than 255 causes this error

patch:

- fixes exception, allowing setting of max size
- sets max size const's of text column types to actual size (not size-1)
- sets max size label of varchar columns to characters, not Bytes

brianfisher’s picture

Status: Active » Needs review
brianfisher’s picture

fix tests

dawehner’s picture

Status: Needs review » Fixed
+++ b/src/Plugin/Field/FieldType/JSONItem.php
@@ -30,24 +30,24 @@ use Drupal\Core\TypedData\DataDefinition;
+   * Schema API normal text 16KB (16*2^10).
...
+   * Schema API medium text 16MB (16*2^20).
...
+   * Schema API big text 4GB (4*2^30).

I kinda prefered 2^16, 2^24 and 2^32 but nevermind, I don't care much.

  • dawehner committed b387296 on 8.x-1.x authored by tbfisher
    Issue #2656580 by tbfisher: Field setting max size = 64KB uncaught...

Status: Fixed » Closed (fixed)

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