diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index d03fe0caf3dbd..92e2bb3254e3d 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -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 # diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result index 5e8b4747f6d09..13163b156ff65 100644 --- a/mysql-test/r/gis-debug.result +++ b/mysql-test/r/gis-debug.result @@ -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 +# diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index be2e39665b352..fba00fe084d70 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -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 +# diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result index 2a665e8700826..5a0bd928f9253 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result @@ -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 +# diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test index 772194e55f4fe..7a4659fb824ef 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test @@ -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 # diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test index ed9a4d491b571..a920f06df9986 100644 --- a/mysql-test/t/default.test +++ b/mysql-test/t/default.test @@ -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 diff --git a/mysql-test/t/gis-debug.test b/mysql-test/t/gis-debug.test index a0647a2c9f458..30fcb3661c465 100644 --- a/mysql-test/t/gis-debug.test +++ b/mysql-test/t/gis-debug.test @@ -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 # diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test index 805c169b2a423..7908fda0ced4a 100644 --- a/mysql-test/t/statistics.test +++ b/mysql-test/t/statistics.test @@ -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 # diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 56e2a7299244c..cb5322a6b93fb 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -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 diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 51e2ee850346f..aa7fabbdb2108 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -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); + } };