Commit 6c626117 authored by Alexander Barkov's avatar Alexander Barkov Committed by Sergei Golubchik

More test for MDEV-10134 Add full support for DEFAULT

Miscelaneous functions:
BENCHMARK(), SLEEP(), ROW_COUNT(), FOUND_ROWS(),
GET_LOCK(), RELEASE_LOCK(), IS_USED_LOCK(), IS_FREE_LOCK(),
MASTER_POS_WAIT(), MASTER_GTID_WAIT(), BINLOG_GTID_POS(),
ST_GIS_DEBUG(), DECODE_HISTOGRAM(),
parent 2654eabb
......@@ -1242,6 +1242,26 @@ SELECT * FROM t1;
a b c
a 97 97
DROP TABLE t1;
CREATE TABLE t1 (a INT DEFAULT BENCHMARK(1,1));
ERROR HY000: Function or expression 'benchmark' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT GET_LOCK('a',1));
ERROR HY000: Function or expression 'get_lock' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT RELEASE_LOCK('a'));
ERROR HY000: Function or expression 'release_lock' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT IS_USED_LOCK('a'));
ERROR HY000: Function or expression 'is_used_lock' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT IS_FREE_LOCK('a'));
ERROR HY000: Function or expression 'is_free_lock' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT SLEEP(1));
ERROR HY000: Function or expression 'sleep' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT ROW_COUNT());
ERROR HY000: Function or expression 'row_count' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT FOUND_ROWS());
ERROR HY000: Function or expression 'found_rows' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT MASTER_POS_WAIT('test',100));
ERROR HY000: Function or expression 'master_pos_wait' is not allowed for 'DEFAULT' of column/constraint 'a'
CREATE TABLE t1 (a INT DEFAULT MASTER_GTID_WAIT('test'));
ERROR HY000: Function or expression 'master_gtid_wait' is not allowed for 'DEFAULT' of column/constraint 'a'
#
# Temporal functions
#
......
......@@ -294,3 +294,14 @@ SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))))
POLYGON((9 9,5 2,4 5,9 9))
#
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
ERROR HY000: Function or expression 'st_gis_debug' is not allowed for 'DEFAULT' of column/constraint 'a'
#
# End of 10.2 tests
#
......@@ -1677,3 +1677,18 @@ Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
drop table t1;
set use_stat_tables=@save_use_stat_tables;
#
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a));
INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF);
SELECT b FROM t1;
b
0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.004,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.004,0.000,0.000,0.004,0.000,0.000,0.000,0.004,0.000,0.000,0.000,0.004,0.000,0.000,0.000,0.004,0.000,0.004,0.000,0.000,0.004,0.000,0.004,0.000,0.004,0.000,0.004,0.004,0.004,0.000,0.004,0.000,0.004,0.004,0.004,0.004,0.004,0.000,0.004,0.004,0.004,0.004,0.004,0.004,0.008,0.004,0.008,0.008,0.008,0.008,0.020,0.004,0.016,0.020,0.016,0.016,0.051,0.031,0.027,0.031,0.043,0.047,0.043,0.043,0.055,0.051,0.071,0.043,0.043,0.043,0.020,0.024,0.024,0.020,0.016,0.016,0.008,0.008,0.012,0.000
DROP TABLE t1;
#
# End of 10.2 tests
#
......@@ -555,3 +555,14 @@ a
connection server_1;
DROP TABLE t1;
include/rpl_end.inc
#
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600));
ERROR HY000: Function or expression 'binlog_gtid_pos' is not allowed for 'DEFAULT' of column/constraint 'a'
#
# End of 10.2 tests
#
......@@ -560,3 +560,18 @@ DROP TABLE t1;
--source include/rpl_end.inc
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-10134 Add full support for DEFAULT
--echo #
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600));
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -959,6 +959,35 @@ INSERT INTO t1 (a) VALUES ('a');
SELECT * FROM t1;
DROP TABLE t1;
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT BENCHMARK(1,1));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT GET_LOCK('a',1));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT RELEASE_LOCK('a'));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT IS_USED_LOCK('a'));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT IS_FREE_LOCK('a'));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT SLEEP(1));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT ROW_COUNT());
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT FOUND_ROWS());
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT MASTER_POS_WAIT('test',100));
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT MASTER_GTID_WAIT('test'));
--echo #
--echo # Temporal functions
......
......@@ -4,3 +4,19 @@
SET @tmp=ST_GIS_DEBUG(1);
--source include/gis_debug.inc
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-10134 Add full support for DEFAULT
--echo #
--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -741,3 +741,20 @@ analyze table t1;
drop table t1;
set use_stat_tables=@save_use_stat_tables;
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-10134 Add full support for DEFAULT
--echo #
CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a));
INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF);
SELECT b FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -613,6 +613,10 @@ class Item_func_gis_debug: public Item_int_func
{ null_value= false; }
const char *func_name() const { return "st_gis_debug"; }
longlong val_int();
bool check_vcol_func_processor(uchar *arg)
{
return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE);
}
};
#endif
......
......@@ -763,6 +763,10 @@ class Item_func_binlog_gtid_pos :public Item_str_func
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "binlog_gtid_pos"; }
bool check_vcol_func_processor(uchar *arg)
{
return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE);
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment