| 1 |
connect con1, localhost, root; |
| 2 |
set lc_time_names = 'es_MX'; |
| 3 |
set time_zone='+10:00'; |
| 4 |
set div_precision_increment=20; |
| 5 |
create table t1 (a int, b int, v decimal(20,19) as (a/3)); |
| 6 |
create table t2 (a int, b int, v int as (a+@a)); |
| 7 |
drop table t2; |
| 8 |
create table t2 (a int, b int, v int as (a+@a) PERSISTENT); |
| 9 |
ERROR HY000: Function or expression '@a' cannot be used in the GENERATED ALWAYS AS clause of `v` |
| 10 |
create table t3_ok (a int, b int, v int as (a+@@error_count)); |
| 11 |
create table t3 (a int, b int, v int as (a+@@error_count) PERSISTENT); |
| 12 |
ERROR HY000: Function or expression '@@error_count' cannot be used in the GENERATED ALWAYS AS clause of `v` |
| 13 |
create table t4 (a int, b int, v int as (@a:=a)); |
| 14 |
drop table t4; |
| 15 |
create table t4 (a int, b int, v int as (@a:=a) PERSISTENT); |
| 16 |
ERROR HY000: Function or expression '@a' cannot be used in the GENERATED ALWAYS AS clause of `v` |
| 17 |
create table t8 (a int, b int, v varchar(100) as (from_unixtime(a))); |
| 18 |
insert t1 (a,b) values (1,2); |
| 19 |
insert t8 (a,b) values (1234567890,2); |
| 20 |
select * from t1; |
| 21 |
a b v |
| 22 |
1 2 0.3333333333333333333 |
| 23 |
select * from t8; |
| 24 |
a b v |
| 25 |
1234567890 2 2009-02-14 09:31:30 |
| 26 |
disconnect con1; |
| 27 |
connection default; |
| 28 |
set time_zone='+1:00'; |
| 29 |
flush tables; |
| 30 |
select * from t1; |
| 31 |
a b v |
| 32 |
1 2 0.3333333330000000000 |
| 33 |
select * from t8; |
| 34 |
a b v |
| 35 |
1234567890 2 2009-02-14 00:31:30 |
| 36 |
drop table t1, t3_ok, t8; |
| 37 |
# |
| 38 |
# Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED |
| 39 |
# |
| 40 |
create table t1 (a int, b serial as (a+1)); |
| 41 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'as (a+1))' at line 1 |
| 42 |
# |
| 43 |
# End of 10.2 tests |
| 44 |
# |
| 45 |
create table t1 (a int, b real as (rand()), c real as (b) stored); |
| 46 |
ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` |
| 47 |
create table t1 (a int, b real as (rand()), c real as (b) unique); |
| 48 |
ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` |
| 49 |
create table t1 (a int auto_increment primary key, |
| 50 |
b int as (a+1), c int as (b+1) stored); |
| 51 |
ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` |
| 52 |
create table t1 (a int auto_increment primary key, |
| 53 |
b int as (a+1), c int as (b+1) unique); |
| 54 |
ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS AS clause of `c` |
| 55 |
# |
| 56 |
# End of 10.3 tests |
| 57 |
# |
| 58 |
# |
| 59 |
# MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs forever, cannot be killed |
| 60 |
# |
| 61 |
create table t1 (a int); |
| 62 |
create table t2 (b int) |
| 63 |
# create or replace table t (b int); |
| 64 |
create table t3 (c int, check(exists(select a from t1) or exists(select b from t2))); |
| 65 |
ERROR 42000: CHECK does not support subqueries or stored functions |
| 66 |
create table t3 (c int, check(exists(select c from t3))); |
| 67 |
ERROR 42000: CHECK does not support subqueries or stored functions |
| 68 |
create table t3 (d int); |
| 69 |
create or replace table t3 (c int, check(exists(select a from t1) or exists(select b from t2))); |
| 70 |
ERROR 42000: CHECK does not support subqueries or stored functions |
| 71 |
drop table t3; |
| 72 |
create table t3 (d int); |
| 73 |
create or replace table t3 (c int, check(exists(select c from t3))); |
| 74 |
ERROR 42000: CHECK does not support subqueries or stored functions |
| 75 |
drop table t3; |
| 76 |
create table t3 (c int); |
| 77 |
alter table t3 add check(exists(select a from t1) or exists(select b from t2)); |
| 78 |
ERROR 42000: CHECK does not support subqueries or stored functions |
| 79 |
alter table t3 add check(exists(select c from t3)); |
| 80 |
ERROR 42000: CHECK does not support subqueries or stored functions |
| 81 |
create table t3 (c int default (select a from t1)); |
| 82 |
ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `c` |
| 83 |
create table t3 (c int, d int generated always as (select a from t1 limit 1)); |
| 84 |
ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `d` |
| 85 |
drop tables t1, t2, t3; |
| 86 |
# |
| 87 |
# End of 10.4 tests |
| 88 |
# |