diff options
author | Igor Babaev <igor@askmonty.org> | 2010-07-13 07:34:14 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2010-07-13 07:34:14 -0700 |
commit | 73be27c07f3283cb35e0fb7085b5068ab360bc01 (patch) | |
tree | cffb27f04190da0612b553bcaf451235463c194f | |
parent | 6197332366ec1908af34b2415f01ccca7757f0c2 (diff) | |
download | mariadb-git-73be27c07f3283cb35e0fb7085b5068ab360bc01.tar.gz |
Fixed bug #604549.
There was no error thrown when creating a table with a virtual table
computed by an expression returning a row.
This caused a crash when inserting into the table.
Removed periods at the end of the error messages for virtual columns.
Adjusted output in test result files accordingly.
19 files changed, 265 insertions, 238 deletions
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 8d765945329..8169bd458e8 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -75,9 +75,9 @@ SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; #illegal value fixed CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS; Warnings: -Warning 1651 Incorrect value '10000000000000000000' for option 'ULL' -Warning 1651 Incorrect value 'ttt' for option 'one_or_two' -Warning 1651 Incorrect value 'SSS' for option 'YESNO' +Warning 1652 Incorrect value '10000000000000000000' for option 'ULL' +Warning 1652 Incorrect value 'ttt' for option 'one_or_two' +Warning 1652 Incorrect value 'SSS' for option 'YESNO' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/table_options.result b/mysql-test/r/table_options.result index e5b23ea4a5a..ed6fe4fb3de 100644 --- a/mysql-test/r/table_options.result +++ b/mysql-test/r/table_options.result @@ -3,9 +3,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE; SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS'; create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1'; Warnings: -Warning 1650 Unknown option 'fkey' -Warning 1650 Unknown option 'dff' -Warning 1650 Unknown option 'tkey1' +Warning 1651 Unknown option 'fkey' +Warning 1651 Unknown option 'dff' +Warning 1651 Unknown option 'tkey1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -16,10 +16,10 @@ drop table t1; #reassiginig options in the same line create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1; Warnings: -Warning 1650 Unknown option 'fkey' -Warning 1650 Unknown option 'dff' -Warning 1650 Unknown option 'tkey1' -Warning 1650 Unknown option 'tkey2' +Warning 1651 Unknown option 'fkey' +Warning 1651 Unknown option 'dff' +Warning 1651 Unknown option 'tkey1' +Warning 1651 Unknown option 'tkey2' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` ( #add option alter table t1 tkey4=4v1; Warnings: -Warning 1650 Unknown option 'tkey4' +Warning 1651 Unknown option 'tkey4' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` ( #remove options alter table t1 tkey3=DEFAULT tkey4=DEFAULT; Warnings: -Warning 1650 Unknown option 'tkey3' -Warning 1650 Unknown option 'tkey4' +Warning 1651 Unknown option 'tkey3' +Warning 1651 Unknown option 'tkey4' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -50,11 +50,11 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1; Warnings: -Warning 1650 Unknown option 'fkey1' -Warning 1650 Unknown option 'kkey1' -Warning 1650 Unknown option 'TKEY1' -Warning 1650 Unknown option 'tkey2' -Warning 1650 Unknown option 'tkey3' +Warning 1651 Unknown option 'fkey1' +Warning 1651 Unknown option 'kkey1' +Warning 1651 Unknown option 'TKEY1' +Warning 1651 Unknown option 'tkey2' +Warning 1651 Unknown option 'tkey3' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -64,7 +64,7 @@ t1 CREATE TABLE `t1` ( #change field with option with the same value alter table t1 change a a int `FKEY1`='v1'; Warnings: -Warning 1650 Unknown option 'FKEY1' +Warning 1651 Unknown option 'FKEY1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` ( #change field with option with a different value alter table t1 change a a int fkey1=v2; Warnings: -Warning 1650 Unknown option 'fkey1' +Warning 1651 Unknown option 'fkey1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` ( #new key with options alter table t1 add key bkey (b) kkey2=v1; Warnings: -Warning 1650 Unknown option 'kkey2' +Warning 1651 Unknown option 'kkey2' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -105,8 +105,8 @@ t1 CREATE TABLE `t1` ( #new column with options alter table t1 add column c int fkey1=v1 fkey2=v2; Warnings: -Warning 1650 Unknown option 'fkey1' -Warning 1650 Unknown option 'fkey2' +Warning 1651 Unknown option 'fkey1' +Warning 1651 Unknown option 'fkey2' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` ( #add column with options after delete alter table t1 add column b int fkey2=v1; Warnings: -Warning 1650 Unknown option 'fkey2' +Warning 1651 Unknown option 'fkey2' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` ( #add key alter table t1 add key bkey (b) kkey2=v2; Warnings: -Warning 1650 Unknown option 'kkey2' +Warning 1651 Unknown option 'kkey2' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -168,7 +168,7 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a int) tkey1=100; Warnings: -Warning 1650 Unknown option 'tkey1' +Warning 1651 Unknown option 'tkey1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/vcol/r/vcol_archive.result b/mysql-test/suite/vcol/r/vcol_archive.result index 1a046dc1fe2..83fb78a5592 100644 --- a/mysql-test/suite/vcol/r/vcol_archive.result +++ b/mysql-test/suite/vcol/r/vcol_archive.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'archive'; create table t1 (a int, b int as (a+1)); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns create table t1 (a int); alter table t1 add column b int as (a+1); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_blackhole.result b/mysql-test/suite/vcol/r/vcol_blackhole.result index 3ee9f626aa9..15e7505aebb 100644 --- a/mysql-test/suite/vcol/r/vcol_blackhole.result +++ b/mysql-test/suite/vcol/r/vcol_blackhole.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'blackhole'; create table t1 (a int, b int as (a+1)); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns create table t1 (a int); alter table t1 add column b int as (a+1); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result index 97991264066..a4099dff381 100644 --- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_innodb.result @@ -1,131 +1,131 @@ SET @@session.storage_engine = 'InnoDB'; # RAND() create table t1 (b double as (rand())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # LOAD_FILE() create table t1 (a varchar(64), b varchar(1024) as (load_file(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # CURDATE() create table t1 (a datetime as (curdate())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_DATE(), CURRENT_DATE create table t1 (a datetime as (current_date)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a datetime as (current_date())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_TIME(), CURRENT_TIME create table t1 (a datetime as (current_time)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a datetime as (current_time())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP create table t1 (a datetime as (current_timestamp())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a datetime as (current_timestamp)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURTIME() create table t1 (a datetime as (curtime())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # LOCALTIME(), LOCALTIME create table t1 (a datetime, b varchar(10) as (localtime())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' create table t1 (a datetime, b varchar(10) as (localtime)); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # LOCALTIMESTAMP, LOCALTIMESTAMP()(v4.0.6) create table t1 (a datetime, b varchar(10) as (localtimestamp())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' create table t1 (a datetime, b varchar(10) as (localtimestamp)); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # NOW() create table t1 (a datetime, b varchar(10) as (now())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # SYSDATE() create table t1 (a int, b varchar(10) as (sysdate())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UNIX_TIMESTAMP() create table t1 (a datetime, b datetime as (unix_timestamp())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UTC_DATE() create table t1 (a datetime, b datetime as (utc_date())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UTC_TIME() create table t1 (a datetime, b datetime as (utc_time())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UTC_TIMESTAMP() create table t1 (a datetime, b datetime as (utc_timestamp())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # MATCH() # BENCHMARK() create table t1 (a varchar(1024), b varchar(1024) as (benchmark(a,3))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # CONNECTION_ID() create table t1 (a int as (connection_id())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_USER(), CURRENT_USER create table t1 (a varchar(32) as (current_user())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a varchar(32) as (current_user)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # DATABASE() create table t1 (a varchar(1024), b varchar(1024) as (database())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # FOUND_ROWS() create table t1 (a varchar(1024), b varchar(1024) as (found_rows())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # GET_LOCK() create table t1 (a varchar(1024), b varchar(1024) as (get_lock(a,10))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # IS_FREE_LOCK() create table t1 (a varchar(1024), b varchar(1024) as (is_free_lock(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # IS_USED_LOCK() create table t1 (a varchar(1024), b varchar(1024) as (is_used_lock(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # LAST_INSERT_ID() create table t1 (a int as (last_insert_id())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # MASTER_POS_WAIT() create table t1 (a varchar(32), b int as (master_pos_wait(a,0,2))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # NAME_CONST() create table t1 (a varchar(32) as (name_const('test',1))); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # RELEASE_LOCK() create table t1 (a varchar(32), b int as (release_lock(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # ROW_COUNT() create table t1 (a int as (row_count())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # SCHEMA() create table t1 (a varchar(32) as (schema())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # SESSION_USER() create table t1 (a varchar(32) as (session_user())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # SLEEP() create table t1 (a int, b int as (sleep(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # SYSTEM_USER() create table t1 (a varchar(32) as (system_user())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # USER() create table t1 (a varchar(1024), b varchar(1024) as (user())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UUID_SHORT() create table t1 (a varchar(1024) as (uuid_short())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # UUID() create table t1 (a varchar(1024) as (uuid())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # VALUES() create table t1 (a varchar(1024), b varchar(1024) as (values(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VERSION() create table t1 (a varchar(1024), b varchar(1024) as (version())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # ENCRYPT() create table t1 (a varchar(1024), b varchar(1024) as (encrypt(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # Stored procedures create procedure p1() begin @@ -137,77 +137,77 @@ begin return 1; end // create table t1 (a int as (p1())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a int as (f1())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' drop procedure p1; drop function f1; # Unknown functions create table t1 (a int as (f1())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # # GROUP BY FUNCTIONS # # AVG() create table t1 (a int, b int as (avg(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BIT_AND() create table t1 (a int, b int as (bit_and(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BIT_OR() create table t1 (a int, b int as (bit_or(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BIT_XOR() create table t1 (a int, b int as (bit_xor(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # COUNT(DISTINCT) create table t1 (a int, b int as (count(distinct a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # COUNT() create table t1 (a int, b int as (count(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # GROUP_CONCAT() create table t1 (a varchar(32), b int as (group_concat(a,''))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # MAX() create table t1 (a int, b int as (max(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # MIN() create table t1 (a int, b int as (min(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STD() create table t1 (a int, b int as (std(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STDDEV_POP() create table t1 (a int, b int as (stddev_pop(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STDDEV_SAMP() create table t1 (a int, b int as (stddev_samp(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STDDEV() create table t1 (a int, b int as (stddev(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # SUM() create table t1 (a int, b int as (sum(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VAR_POP() create table t1 (a int, b int as (var_pop(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VAR_SAMP() create table t1 (a int, b int as (var_samp(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VARIANCE() create table t1 (a int, b int as (variance(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # # XML FUNCTIONS # # ExtractValue() create table t1 (a varchar(1024), b varchar(1024) as (ExtractValue(a,'//b[$@j]'))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UpdateXML() create table t1 (a varchar(1024), b varchar(1024) as (UpdateXML(a,'/a','<e>fff</e>'))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # # Sub-selects # @@ -216,9 +216,9 @@ create table t2 (a int, b int as (select count(*) from t1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select count(*) from t1))' at line 1 drop table t1; create table t1 (a int, b int as ((select 1))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' create table t1 (a int, b int as (a+(select 1))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # # SP functions # @@ -229,7 +229,7 @@ select sub1(1); sub1(1) 2 create table t1 (a int, b int as (a+sub3(1))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' drop function sub1; # # Long expression @@ -240,4 +240,4 @@ ERROR HY000: String 'concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # # Constant expression create table t1 (a int as (PI())); -ERROR HY000: Constant expression in computed column function is not allowed. +ERROR HY000: Constant expression in computed column function is not allowed diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result index c3815e991e7..dda222f5e8a 100644 --- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs_myisam.result @@ -1,133 +1,133 @@ SET @@session.storage_engine = 'MyISAM'; # RAND() create table t1 (b double as (rand())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # LOAD_FILE() create table t1 (a varchar(64), b varchar(1024) as (load_file(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # CURDATE() create table t1 (a datetime as (curdate())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_DATE(), CURRENT_DATE create table t1 (a datetime as (current_date)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a datetime as (current_date())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_TIME(), CURRENT_TIME create table t1 (a datetime as (current_time)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a datetime as (current_time())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP create table t1 (a datetime as (current_timestamp())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a datetime as (current_timestamp)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURTIME() create table t1 (a datetime as (curtime())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # LOCALTIME(), LOCALTIME create table t1 (a datetime, b varchar(10) as (localtime())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' create table t1 (a datetime, b varchar(10) as (localtime)); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # LOCALTIMESTAMP, LOCALTIMESTAMP()(v4.0.6) create table t1 (a datetime, b varchar(10) as (localtimestamp())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' create table t1 (a datetime, b varchar(10) as (localtimestamp)); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # NOW() create table t1 (a datetime, b varchar(10) as (now())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # SYSDATE() create table t1 (a int, b varchar(10) as (sysdate())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UNIX_TIMESTAMP() create table t1 (a datetime, b datetime as (unix_timestamp())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UTC_DATE() create table t1 (a datetime, b datetime as (utc_date())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UTC_TIME() create table t1 (a datetime, b datetime as (utc_time())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UTC_TIMESTAMP() create table t1 (a datetime, b datetime as (utc_timestamp())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # MATCH() create table t1 (a varchar(32), b bool as (match a against ('sample text'))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BENCHMARK() create table t1 (a varchar(1024), b varchar(1024) as (benchmark(a,3))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # CONNECTION_ID() create table t1 (a int as (connection_id())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # CURRENT_USER(), CURRENT_USER create table t1 (a varchar(32) as (current_user())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a varchar(32) as (current_user)); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # DATABASE() create table t1 (a varchar(1024), b varchar(1024) as (database())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # FOUND_ROWS() create table t1 (a varchar(1024), b varchar(1024) as (found_rows())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # GET_LOCK() create table t1 (a varchar(1024), b varchar(1024) as (get_lock(a,10))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # IS_FREE_LOCK() create table t1 (a varchar(1024), b varchar(1024) as (is_free_lock(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # IS_USED_LOCK() create table t1 (a varchar(1024), b varchar(1024) as (is_used_lock(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # LAST_INSERT_ID() create table t1 (a int as (last_insert_id())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # MASTER_POS_WAIT() create table t1 (a varchar(32), b int as (master_pos_wait(a,0,2))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # NAME_CONST() create table t1 (a varchar(32) as (name_const('test',1))); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # RELEASE_LOCK() create table t1 (a varchar(32), b int as (release_lock(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # ROW_COUNT() create table t1 (a int as (row_count())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # SCHEMA() create table t1 (a varchar(32) as (schema())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # SESSION_USER() create table t1 (a varchar(32) as (session_user())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # SLEEP() create table t1 (a int, b int as (sleep(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # SYSTEM_USER() create table t1 (a varchar(32) as (system_user())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # USER() create table t1 (a varchar(1024), b varchar(1024) as (user())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UUID_SHORT() create table t1 (a varchar(1024) as (uuid_short())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # UUID() create table t1 (a varchar(1024) as (uuid())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # VALUES() create table t1 (a varchar(1024), b varchar(1024) as (values(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VERSION() create table t1 (a varchar(1024), b varchar(1024) as (version())); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # ENCRYPT() create table t1 (a varchar(1024), b varchar(1024) as (encrypt(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # Stored procedures create procedure p1() begin @@ -139,77 +139,77 @@ begin return 1; end // create table t1 (a int as (p1())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' create table t1 (a int as (f1())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' drop procedure p1; drop function f1; # Unknown functions create table t1 (a int as (f1())); -ERROR HY000: Function or expression is not allowed for column 'a'. +ERROR HY000: Function or expression is not allowed for column 'a' # # GROUP BY FUNCTIONS # # AVG() create table t1 (a int, b int as (avg(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BIT_AND() create table t1 (a int, b int as (bit_and(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BIT_OR() create table t1 (a int, b int as (bit_or(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # BIT_XOR() create table t1 (a int, b int as (bit_xor(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # COUNT(DISTINCT) create table t1 (a int, b int as (count(distinct a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # COUNT() create table t1 (a int, b int as (count(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # GROUP_CONCAT() create table t1 (a varchar(32), b int as (group_concat(a,''))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # MAX() create table t1 (a int, b int as (max(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # MIN() create table t1 (a int, b int as (min(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STD() create table t1 (a int, b int as (std(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STDDEV_POP() create table t1 (a int, b int as (stddev_pop(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STDDEV_SAMP() create table t1 (a int, b int as (stddev_samp(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # STDDEV() create table t1 (a int, b int as (stddev(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # SUM() create table t1 (a int, b int as (sum(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VAR_POP() create table t1 (a int, b int as (var_pop(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VAR_SAMP() create table t1 (a int, b int as (var_samp(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # VARIANCE() create table t1 (a int, b int as (variance(a))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # # XML FUNCTIONS # # ExtractValue() create table t1 (a varchar(1024), b varchar(1024) as (ExtractValue(a,'//b[$@j]'))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # UpdateXML() create table t1 (a varchar(1024), b varchar(1024) as (UpdateXML(a,'/a','<e>fff</e>'))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # # Sub-selects # @@ -218,9 +218,9 @@ create table t2 (a int, b int as (select count(*) from t1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select count(*) from t1))' at line 1 drop table t1; create table t1 (a int, b int as ((select 1))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' create table t1 (a int, b int as (a+(select 1))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' # # SP functions # @@ -231,7 +231,7 @@ select sub1(1); sub1(1) 2 create table t1 (a int, b int as (a+sub3(1))); -ERROR HY000: Function or expression is not allowed for column 'b'. +ERROR HY000: Function or expression is not allowed for column 'b' drop function sub1; # # Long expression @@ -242,4 +242,4 @@ ERROR HY000: String 'concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # # Constant expression create table t1 (a int as (PI())); -ERROR HY000: Constant expression in computed column function is not allowed. +ERROR HY000: Constant expression in computed column function is not allowed diff --git a/mysql-test/suite/vcol/r/vcol_csv.result b/mysql-test/suite/vcol/r/vcol_csv.result index 79c1bd2d6f4..97977505696 100644 --- a/mysql-test/suite/vcol/r/vcol_csv.result +++ b/mysql-test/suite/vcol/r/vcol_csv.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'CSV'; create table t1 (a int, b int as (a+1)); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns create table t1 (a int not null); alter table t1 add column b int as (a+1); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result b/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result index 6d1fb0d3526..b996a0108e3 100644 --- a/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result @@ -25,8 +25,8 @@ a b c # INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols insert into t1 values (1,2,3); Warnings: -Warning 1645 The value specified for computed column 'b' in table 't1' ignored. -Warning 1645 The value specified for computed column 'c' in table 't1' ignored. +Warning 1645 The value specified for computed column 'b' in table 't1' ignored +Warning 1645 The value specified for computed column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -65,8 +65,8 @@ a b c # against vcols insert into t1 (a,b) values (1,3), (2,4); Warnings: -Warning 1645 The value specified for computed column 'b' in table 't1' ignored. -Warning 1645 The value specified for computed column 'b' in table 't1' ignored. +Warning 1645 The value specified for computed column 'b' in table 't1' ignored +Warning 1645 The value specified for computed column 'b' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -107,8 +107,8 @@ a b c create table t2 like t1; insert into t2 select * from t1; Warnings: -Warning 1645 The value specified for computed column 'b' in table 't2' ignored. -Warning 1645 The value specified for computed column 'c' in table 't2' ignored. +Warning 1645 The value specified for computed column 'b' in table 't2' ignored +Warning 1645 The value specified for computed column 'c' in table 't2' ignored select * from t1; a b c 2 -2 -2 @@ -123,8 +123,8 @@ a b c create table t2 like t1; insert into t2 (a,b) select a,b from t1; Warnings: -Warning 1645 The value specified for computed column 'b' in table 't2' ignored. -Warning 1645 The value specified for computed column 'b' in table 't2' ignored. +Warning 1645 The value specified for computed column 'b' in table 't2' ignored +Warning 1645 The value specified for computed column 'b' in table 't2' ignored select * from t2; a b c 2 -2 -2 @@ -159,7 +159,7 @@ a b c 2 -2 -2 update t1 set c=3 where a=2; Warnings: -Warning 1645 The value specified for computed column 'c' in table 't1' ignored. +Warning 1645 The value specified for computed column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -189,7 +189,7 @@ a b c 2 -2 -2 update t1 set c=3 where b=-2; Warnings: -Warning 1645 The value specified for computed column 'c' in table 't1' ignored. +Warning 1645 The value specified for computed column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 diff --git a/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result b/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result index 9aac0086b4a..fa636597536 100644 --- a/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result @@ -25,8 +25,8 @@ a b c # INSERT INTO tbl_name VALUES... a non-NULL value is specified against vcols insert into t1 values (1,2,3); Warnings: -Warning 1645 The value specified for computed column 'b' in table 't1' ignored. -Warning 1645 The value specified for computed column 'c' in table 't1' ignored. +Warning 1645 The value specified for computed column 'b' in table 't1' ignored +Warning 1645 The value specified for computed column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -65,8 +65,8 @@ a b c # against vcols insert into t1 (a,b) values (1,3), (2,4); Warnings: -Warning 1645 The value specified for computed column 'b' in table 't1' ignored. -Warning 1645 The value specified for computed column 'b' in table 't1' ignored. +Warning 1645 The value specified for computed column 'b' in table 't1' ignored +Warning 1645 The value specified for computed column 'b' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -107,8 +107,8 @@ a b c create table t2 like t1; insert into t2 select * from t1; Warnings: -Warning 1645 The value specified for computed column 'b' in table 't2' ignored. -Warning 1645 The value specified for computed column 'c' in table 't2' ignored. +Warning 1645 The value specified for computed column 'b' in table 't2' ignored +Warning 1645 The value specified for computed column 'c' in table 't2' ignored select * from t1; a b c 2 -2 -2 @@ -123,8 +123,8 @@ a b c create table t2 like t1; insert into t2 (a,b) select a,b from t1; Warnings: -Warning 1645 The value specified for computed column 'b' in table 't2' ignored. -Warning 1645 The value specified for computed column 'b' in table 't2' ignored. +Warning 1645 The value specified for computed column 'b' in table 't2' ignored +Warning 1645 The value specified for computed column 'b' in table 't2' ignored select * from t2; a b c 2 -2 -2 @@ -159,7 +159,7 @@ a b c 2 -2 -2 update t1 set c=3 where a=2; Warnings: -Warning 1645 The value specified for computed column 'c' in table 't1' ignored. +Warning 1645 The value specified for computed column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 @@ -189,7 +189,7 @@ a b c 2 -2 -2 update t1 set c=3 where b=-2; Warnings: -Warning 1645 The value specified for computed column 'c' in table 't1' ignored. +Warning 1645 The value specified for computed column 'c' in table 't1' ignored select * from t1; a b c 1 -1 -1 diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result index ee272fb7db8..857dcb8423f 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result @@ -7,7 +7,7 @@ SET @@session.storage_engine = 'InnoDB'; # - CHECK (allowed but not used) # UNIQUE create table t1 (a int, b int as (a*2) unique); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2) persistent unique); show create table t1; Table Create Table @@ -22,7 +22,7 @@ a int(11) YES NULL b int(11) YES UNI NULL VIRTUAL drop table t1; create table t1 (a int, b int as (a*2), unique key (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2) persistent, unique (b)); show create table t1; Table Create Table @@ -38,7 +38,7 @@ b int(11) YES UNI NULL VIRTUAL drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add unique key (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add unique key (b); @@ -50,9 +50,9 @@ drop table t1; # # INDEX create table t1 (a int, b int as (a*2), index (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2), index (a,b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2) persistent, index (b)); show create table t1; Table Create Table @@ -81,9 +81,9 @@ b int(11) YES NULL VIRTUAL drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add index (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column alter table t1 add index (a,b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add index (b); @@ -103,27 +103,27 @@ drop table t1; # Rejected FK options. create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update set null); -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update cascade); -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on delete set null); -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column create table t1 (a int, b int as (a+1) persistent); alter table t1 add foreign key (b) references t2(a) on update set null; -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column alter table t1 add foreign key (b) references t2(a) on update cascade; -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column alter table t1 add foreign key (b) references t2(a) on delete set null; -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column drop table t1; create table t1 (a int, b int as (a+1), foreign key (b) references t2(a)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a+1)); alter table t1 add foreign key (b) references t2(a); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; # Allowed FK options. create table t2 (a int primary key, b char(5)); diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result index 8a11e44f201..af0935affbc 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result @@ -7,7 +7,7 @@ SET @@session.storage_engine = 'MyISAM'; # - CHECK (allowed but not used) # UNIQUE create table t1 (a int, b int as (a*2) unique); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2) persistent unique); show create table t1; Table Create Table @@ -22,7 +22,7 @@ a int(11) YES NULL b int(11) YES UNI NULL VIRTUAL drop table t1; create table t1 (a int, b int as (a*2), unique key (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2) persistent, unique (b)); show create table t1; Table Create Table @@ -38,7 +38,7 @@ b int(11) YES UNI NULL VIRTUAL drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add unique key (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add unique key (b); @@ -50,9 +50,9 @@ drop table t1; # # INDEX create table t1 (a int, b int as (a*2), index (b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2), index (a,b)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a*2) persistent, index (b)); show create table t1; Table Create Table @@ -81,9 +81,9 @@ b int(11) YES NULL VIRTUAL drop table t1; create table t1 (a int, b int as (a*2)); alter table t1 add index (b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column alter table t1 add index (a,b); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; create table t1 (a int, b int as (a*2) persistent); alter table t1 add index (b); @@ -110,27 +110,27 @@ drop table t1; # Rejected FK options. create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update set null); -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on update cascade); -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column create table t1 (a int, b int as (a+1) persistent, foreign key (b) references t2(a) on delete set null); -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column create table t1 (a int, b int as (a+1) persistent); alter table t1 add foreign key (b) references t2(a) on update set null; -ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE SET NULL clause on a computed column alter table t1 add foreign key (b) references t2(a) on update cascade; -ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column. +ERROR HY000: Cannot define foreign key with ON UPDATE CASCADE clause on a computed column alter table t1 add foreign key (b) references t2(a) on delete set null; -ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column. +ERROR HY000: Cannot define foreign key with ON DELETE SET NULL clause on a computed column drop table t1; create table t1 (a int, b int as (a+1), foreign key (b) references t2(a)); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column create table t1 (a int, b int as (a+1)); alter table t1 add foreign key (b) references t2(a); -ERROR HY000: Key/Index cannot be defined on a non-stored computed column. +ERROR HY000: Key/Index cannot be defined on a non-stored computed column drop table t1; # Allowed FK options. create table t2 (a int primary key, b char(5)); diff --git a/mysql-test/suite/vcol/r/vcol_memory.result b/mysql-test/suite/vcol/r/vcol_memory.result index 37154df61e7..30b6bd4a4bf 100644 --- a/mysql-test/suite/vcol/r/vcol_memory.result +++ b/mysql-test/suite/vcol/r/vcol_memory.result @@ -1,7 +1,7 @@ SET @@session.storage_engine = 'memory'; create table t1 (a int, b int as (a+1)); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns create table t1 (a int); alter table t1 add column b int as (a+1); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_merge.result b/mysql-test/suite/vcol/r/vcol_merge.result index 32f3268329f..03a1e151c2e 100644 --- a/mysql-test/suite/vcol/r/vcol_merge.result +++ b/mysql-test/suite/vcol/r/vcol_merge.result @@ -4,5 +4,5 @@ create table t2 (a int, b int as (a % 10)); insert into t1 values (1,default); insert into t2 values (2,default); create table t3 (a int, b int as (a % 10)) engine=MERGE UNION=(t1,t2); -ERROR HY000: 'Specified storage engine' is not yet supported for computed columns. +ERROR HY000: 'Specified storage engine' is not yet supported for computed columns drop table t1,t2; diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index f312527794a..896dd6fa654 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -30,3 +30,8 @@ a b v 5 50 6 8 80 9 drop table t1; +CREATE TABLE t1 ( +a int NOT NULL DEFAULT '0', +v double AS ((1, a)) VIRTUAL +); +ERROR HY000: Expression for computed column cannot return a row diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result index 0f46abf0054..c638ced4f41 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result @@ -76,7 +76,7 @@ drop table t1; # Case 7. ALTER. Modify virtual stored -> virtual non-stored create table t1 (a int, b int as (a % 2) persistent); alter table t1 modify b int as (a % 2); -ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns. +ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -87,7 +87,7 @@ drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) persistent; -ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns. +ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result index 3c7d29ef6fe..be42b8b76c4 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result @@ -76,7 +76,7 @@ drop table t1; # Case 7. ALTER. Modify virtual stored -> virtual non-stored create table t1 (a int, b int as (a % 2) persistent); alter table t1 modify b int as (a % 2); -ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns. +ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -87,7 +87,7 @@ drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored create table t1 (a int, b int as (a % 2)); alter table t1 modify b int as (a % 2) persistent; -ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns. +ERROR HY000: 'Changing the STORED status' is not yet supported for computed columns show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index a0e654daa57..06a9313edd3 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -19,3 +19,17 @@ update t1 set a=v order by b limit 1; select * from t1 order by b; drop table t1; + +# +# Bug#604549: Expression for virtual column returns row +# + +-- error ER_ROW_EXPR_FOR_VCOL +CREATE TABLE t1 ( + a int NOT NULL DEFAULT '0', + v double AS ((1, a)) VIRTUAL +); + + + + diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 117a4b8e1e6..023bd57e14f 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6211,28 +6211,31 @@ ER_VCOL_BASED_ON_VCOL eng "A computed column cannot be based on a computed column" ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED - eng "Function or expression is not allowed for column '%s'." + eng "Function or expression is not allowed for column '%s'" ER_DATA_CONVERSION_ERROR_FOR_VIRTUAL_COLUMN - eng "Generated value for computed column '%s' cannot be converted to type '%s'." + eng "Generated value for computed column '%s' cannot be converted to type '%s'" ER_PRIMARY_KEY_BASED_ON_VIRTUAL_COLUMN - eng "Primary key cannot be defined upon a computed column." + eng "Primary key cannot be defined upon a computed column" ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN - eng "Key/Index cannot be defined on a non-stored computed column." + eng "Key/Index cannot be defined on a non-stored computed column" ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN - eng "Cannot define foreign key with %s clause on a computed column." + eng "Cannot define foreign key with %s clause on a computed column" ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN - eng "The value specified for computed column '%s' in table '%s' ignored." + eng "The value specified for computed column '%s' in table '%s' ignored" ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN - eng "'%s' is not yet supported for computed columns." + eng "'%s' is not yet supported for computed columns" ER_CONST_EXPR_IN_VCOL - eng "Constant expression in computed column function is not allowed." + eng "Constant expression in computed column function is not allowed" + +ER_ROW_EXPR_FOR_VCOL + eng "Expression for computed column cannot return a row" ER_DEBUG_SYNC_TIMEOUT eng "debug sync point wait timed out" diff --git a/sql/table.cc b/sql/table.cc index b9a2a8be2f1..451515c1262 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1859,6 +1859,11 @@ bool fix_vcol_expr(THD *thd, goto end; } thd->where= save_where; + if (unlikely(func_expr->result_type() == ROW_RESULT)) + { + my_error(ER_ROW_EXPR_FOR_VCOL, MYF(0)); + goto end; + } #ifdef PARANOID /* Walk through the Item tree checking if all items are valid |