403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.68.164.134
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/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/json/inc/json_ddl.inc
--echo Verify that JSON columns do not support indexes on create table

--error 3152
CREATE TABLE bad(i INT, j1bad JSON NOT NULL PRIMARY KEY);
--error 3152
CREATE TABLE bad(i INT, j1bad JSON NOT NULL, INDEX j1badindex (j1bad));
--error 3152
CREATE TABLE bad(i INT, j1bad JSON NOT NULL, UNIQUE INDEX j1badindex (j1bad));
--error 3152
CREATE TABLE bad(i INT, j1bad JSON NOT NULL, UNIQUE INDEX j1badindex (j1bad) USING HASH);

CREATE TABLE t1(i INT PRIMARY KEY);
ALTER TABLE t1 ADD COLUMN j1 JSON;
ALTER TABLE t1 ADD COLUMN j2 JSON NOT NULL;
# A JSON column cannot be used as a key.
--error ER_JSON_USED_AS_KEY
CREATE INDEX t1_idx_j ON t1(j1);
--error ER_JSON_USED_AS_KEY
CREATE INDEX t1_idx_i_j ON t1(i, j1);
--error ER_JSON_USED_AS_KEY
CREATE INDEX t1_idx_j_i ON t1(j1, i);
CREATE INDEX t1_idx_i ON t1(i);
DROP INDEX t1_idx_i ON t1;

DROP TABLE t1;

--echo Verify that JSON columns do not support indexes on alter table
CREATE TABLE t2(i INT PRIMARY KEY, j1 JSON, j2 JSON NOT NULL);
--error 3152
ALTER TABLE t2 ADD INDEX j1badindex (j1);
--error 3152
ALTER TABLE t2 ADD UNIQUE INDEX j1badindex (j1);
--error 3152
ALTER TABLE t2 ADD UNIQUE INDEX j1badindex (j1) USING HASH;

--echo Verify that JSON columns can be dropped
ALTER TABLE t2 DROP COLUMN j1;
ALTER TABLE t2 DROP COLUMN j2;

DROP TABLE t2;

# JSON is a non-reserved keyword, so it should be possible to use it
# as an identifier.
CREATE TABLE json(json int);
INSERT INTO json(json) VALUES (1);
SELECT json FROM json;
DROP TABLE json;

# And it should be possible to use it as a label in a stored procedure.
DELIMITER |;
CREATE PROCEDURE p()
BEGIN
  json: LOOP
    LEAVE json;
  END LOOP json;
END|
DELIMITER ;|
CALL p();
DROP PROCEDURE p;

--echo #
--echo #  Bug#22278524: ALTER TABLE SOMETIMES CONVERTS TEXT TO JSON WITHOUT
--echo #                SYNTAX CHECKING
--echo #
CREATE TABLE t1(txt TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin);
INSERT INTO t1 VALUES ('not JSON');
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_INVALID_JSON_TEXT
ALTER TABLE t1 MODIFY COLUMN txt JSON;
SELECT * FROM t1;
CREATE TABLE t2(j JSON);
INSERT INTO t2 VALUES (JSON_OBJECT('a', 'b'));
ALTER TABLE t2 MODIFY COLUMN j TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
SELECT * FROM t2;
CREATE TABLE t3 (j JSON);
INSERT INTO t3 VALUES (JSON_OBJECT('a', 'b'));
CREATE TABLE t4 AS SELECT UPPER(j) AS jj FROM t3;
INSERT INTO t4 VALUES ('not JSON');
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_INVALID_JSON_TEXT
ALTER TABLE t4 MODIFY COLUMN jj JSON;
SELECT * FROM t4 order by jj;
DROP TABLE t1, t2, t3, t4;

Youez - 2016 - github.com/yon3zu
LinuXploit