mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-32235: mysql_json cannot be used on newly created table
- Closes PR #2839
- Usage of `Column_definition_fix_attributes()` suggested by Alexandar
Barkov - thanks bar, that is better than hook in server code
(reverted 22f3ebe4bf
)
- This method is called after parsing the data type:
* in `CREATE/ALTER TABLE`
* in SP: return data type, parameter data type, variable data type
- We want to disallow all these use cases of MYSQL_JSON.
- Reviewer: bar@mariadb.com
cvicentiu@mariadb.org
This commit is contained in:
committed by
Alexander Barkov
parent
8b5c1d5afa
commit
8a763c014e
@ -51,6 +51,13 @@ show create table mysql_json_test;
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
select * from mysql_json_test;
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
CREATE TABLE t2 AS SELECT * FROM mysql_json_test;
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE TABLE t2 (a mysql_json /*new column*/) AS SELECT * FROM mysql_json_test;
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE TABLE t2 (actual mysql_json /*existing column*/) AS SELECT * FROM mysql_json_test;
|
||||
|
||||
--error ER_TABLE_NEEDS_REBUILD
|
||||
LOCK TABLES mysql_json_test WRITE;
|
||||
|
||||
@ -97,9 +104,8 @@ drop table mysql_json_test_big;
|
||||
create table t1(j json);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
create table t1(j mysql_json);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
# `json` type should not have character set and collation other than utf8mb4_bin
|
||||
--error ER_PARSE_ERROR
|
||||
create table `testjson` (
|
||||
@ -121,6 +127,37 @@ create table `testjson` (
|
||||
show create table testjson;
|
||||
drop table testjson;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32235: mysql_json cannot be used on newly created table
|
||||
--echo #
|
||||
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE TABLE t(j mysql_json);
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE TABLE IF NOT EXISTS t(j mysql_json);
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE OR REPLACE TABLE t(j mysql_json);
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE TEMPORARY TABLE t(j mysql_json);
|
||||
|
||||
CREATE TABLE t1 (a TEXT);
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
ALTER TABLE t1 MODIFY a mysql_json;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE FUNCTION f1() RETURNS mysql_json RETURN NULL;
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE FUNCTION f1(a mysql_json) RETURNS INT RETURN 0;
|
||||
DELIMITER $$;
|
||||
--error ER_NOT_ALLOWED_IN_THIS_CONTEXT
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE a mysql_json;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user