2

Recently Migrated Table Column from data type Text to Json.

Suppose I have listing table with this table definition and inserted few records in it

CREATE TABLE `listing` ( 
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`data` json NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin

when i try to update any data in JSON specified column it throws exception : data truncation: cannot create a JSON value from a string with Character Set 'binary'

Though followed article : https://dev.mysql.com/doc/refman/5.7/en/json.html

which is also refering to utf8mb4_bin because comparison of JSON values is case-sensitive

5
  • Possible duplicate of MySQL 5.7.12 import cannot create a JSON value from a string with CHARACTER SET 'binary' Commented Jan 9, 2018 at 13:30
  • Not a duplicate one because CHARSET is already on utf8mb4 Commented Jan 9, 2018 at 13:37
  • try without COLLATE=utf8mb4_bin Commented Jan 9, 2018 at 13:53
  • please show what data you are storing (example) Commented Jan 9, 2018 at 13:54
  • Please, show your insert statement. Commented Jan 9, 2018 at 13:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.