mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
More test for MDEV-10134 Add full support for DEFAULT
Dynamic column functions
This commit is contained in:
parent
b5870a5dd3
commit
a3e756c5b8
2 changed files with 70 additions and 0 deletions
|
@ -1875,3 +1875,40 @@ COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL))
|
|||
#
|
||||
# end of 10.0 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-10134 Add full support for DEFAULT
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
name VARCHAR(10),
|
||||
value VARCHAR(10),
|
||||
dyncol0 BLOB DEFAULT COLUMN_CREATE(name, value),
|
||||
value_dyncol0_name0 VARCHAR(10) DEFAULT COLUMN_GET(dyncol0, 'name0' AS CHAR),
|
||||
dyncol1 BLOB DEFAULT COLUMN_ADD(dyncol0, 'name1', 'value1'),
|
||||
value_dyncol1_name1 VARCHAR(10) DEFAULT COLUMN_GET(dyncol1, 'name1' AS CHAR),
|
||||
dyncol2 BLOB DEFAULT COLUMN_DELETE(dyncol1, 'name1'),
|
||||
dyncol2_exists_name0 INT DEFAULT COLUMN_EXISTS(dyncol2, 'name0'),
|
||||
dyncol2_exists_name1 INT DEFAULT COLUMN_EXISTS(dyncol2, 'name1'),
|
||||
dyncol2_check INT DEFAULT COLUMN_CHECK(dyncol2),
|
||||
dyncol1_list TEXT DEFAULT COLUMN_LIST(dyncol1),
|
||||
dyncol1_json TEXT DEFAULT COLUMN_JSON(dyncol1)
|
||||
);
|
||||
INSERT INTO t1 (name,value) VALUES ('name0', 'value0');
|
||||
SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1;
|
||||
value_dyncol0_name0 value_dyncol1_name1
|
||||
value0 value1
|
||||
SELECT dyncol2_check, dyncol2_exists_name0, dyncol2_exists_name1 FROM t1;
|
||||
dyncol2_check dyncol2_exists_name0 dyncol2_exists_name1
|
||||
1 1 0
|
||||
SELECT dyncol1_list FROM t1;
|
||||
dyncol1_list
|
||||
`name0`,`name1`
|
||||
SELECT dyncol1_json FROM t1;
|
||||
dyncol1_json
|
||||
{"name0":"value0","name1":"value1"}
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
|
|
@ -923,3 +923,36 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
|
|||
--echo #
|
||||
--echo # end of 10.0 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10134 Add full support for DEFAULT
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
name VARCHAR(10),
|
||||
value VARCHAR(10),
|
||||
dyncol0 BLOB DEFAULT COLUMN_CREATE(name, value),
|
||||
value_dyncol0_name0 VARCHAR(10) DEFAULT COLUMN_GET(dyncol0, 'name0' AS CHAR),
|
||||
dyncol1 BLOB DEFAULT COLUMN_ADD(dyncol0, 'name1', 'value1'),
|
||||
value_dyncol1_name1 VARCHAR(10) DEFAULT COLUMN_GET(dyncol1, 'name1' AS CHAR),
|
||||
dyncol2 BLOB DEFAULT COLUMN_DELETE(dyncol1, 'name1'),
|
||||
dyncol2_exists_name0 INT DEFAULT COLUMN_EXISTS(dyncol2, 'name0'),
|
||||
dyncol2_exists_name1 INT DEFAULT COLUMN_EXISTS(dyncol2, 'name1'),
|
||||
dyncol2_check INT DEFAULT COLUMN_CHECK(dyncol2),
|
||||
dyncol1_list TEXT DEFAULT COLUMN_LIST(dyncol1),
|
||||
dyncol1_json TEXT DEFAULT COLUMN_JSON(dyncol1)
|
||||
);
|
||||
INSERT INTO t1 (name,value) VALUES ('name0', 'value0');
|
||||
SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1;
|
||||
SELECT dyncol2_check, dyncol2_exists_name0, dyncol2_exists_name1 FROM t1;
|
||||
SELECT dyncol1_list FROM t1;
|
||||
SELECT dyncol1_json FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
|
Loading…
Add table
Reference in a new issue