Server IP : 172.67.216.182 / Your IP : 162.158.108.43 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/json/r/ |
Upload File : |
set default_storage_engine=ndb; Verify that JSON columns do not support indexes on create table CREATE TABLE bad(i INT, j1bad JSON NOT NULL PRIMARY KEY); ERROR 42000: JSON column 'j1bad' cannot be used in key specification. CREATE TABLE bad(i INT, j1bad JSON NOT NULL, INDEX j1badindex (j1bad)); ERROR 42000: JSON column 'j1bad' cannot be used in key specification. CREATE TABLE bad(i INT, j1bad JSON NOT NULL, UNIQUE INDEX j1badindex (j1bad)); ERROR 42000: JSON column 'j1bad' cannot be used in key specification. CREATE TABLE bad(i INT, j1bad JSON NOT NULL, UNIQUE INDEX j1badindex (j1bad) USING HASH); ERROR 42000: JSON column 'j1bad' cannot be used in key specification. CREATE TABLE t1(i INT PRIMARY KEY); ALTER TABLE t1 ADD COLUMN j1 JSON; ALTER TABLE t1 ADD COLUMN j2 JSON NOT NULL; CREATE INDEX t1_idx_j ON t1(j1); ERROR 42000: JSON column 'j1' cannot be used in key specification. CREATE INDEX t1_idx_i_j ON t1(i, j1); ERROR 42000: JSON column 'j1' cannot be used in key specification. CREATE INDEX t1_idx_j_i ON t1(j1, i); ERROR 42000: JSON column 'j1' cannot be used in key specification. CREATE INDEX t1_idx_i ON t1(i); DROP INDEX t1_idx_i ON t1; DROP TABLE t1; Verify that JSON columns do not support indexes on alter table CREATE TABLE t2(i INT PRIMARY KEY, j1 JSON, j2 JSON NOT NULL); ALTER TABLE t2 ADD INDEX j1badindex (j1); ERROR 42000: JSON column 'j1' cannot be used in key specification. ALTER TABLE t2 ADD UNIQUE INDEX j1badindex (j1); ERROR 42000: JSON column 'j1' cannot be used in key specification. ALTER TABLE t2 ADD UNIQUE INDEX j1badindex (j1) USING HASH; ERROR 42000: JSON column 'j1' cannot be used in key specification. Verify that JSON columns can be dropped ALTER TABLE t2 DROP COLUMN j1; ALTER TABLE t2 DROP COLUMN j2; DROP TABLE t2; CREATE TABLE json(json int); INSERT INTO json(json) VALUES (1); SELECT json FROM json; json 1 DROP TABLE json; CREATE PROCEDURE p() BEGIN json: LOOP LEAVE json; END LOOP json; END| CALL p(); DROP PROCEDURE p; # # Bug#22278524: ALTER TABLE SOMETIMES CONVERTS TEXT TO JSON WITHOUT # SYNTAX CHECKING # CREATE TABLE t1(txt TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin); Warnings: Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t1 VALUES ('not JSON'); ALTER TABLE t1 MODIFY COLUMN txt JSON; ERROR 22032: Invalid JSON text: "Invalid value." at position 1 in value for column '#sql-temporary.txt'. SELECT * FROM t1; txt not JSON CREATE TABLE t2(j JSON); Warnings: Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t2 VALUES (JSON_OBJECT('a', 'b')); ALTER TABLE t2 MODIFY COLUMN j TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; Warnings: Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' SELECT * FROM t2; j {"a": "b"} CREATE TABLE t3 (j JSON); Warnings: Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t3 VALUES (JSON_OBJECT('a', 'b')); CREATE TABLE t4 AS SELECT UPPER(j) AS jj FROM t3; Warnings: Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t4 VALUES ('not JSON'); ALTER TABLE t4 MODIFY COLUMN jj JSON; ERROR 22032: Invalid JSON text: "Invalid value." at position 1 in value for column '#sql-temporary.jj'. SELECT * FROM t4 order by jj; jj not JSON {"A": "B"} DROP TABLE t1, t2, t3, t4;