| 1 |
################################################################################ |
| 2 |
# inc/gcol_dependencies_on_gcol.inc # |
| 3 |
# # |
| 4 |
# Purpose: # |
| 5 |
# Testing scenarios when columns depend on generated columns, i.e. such as # |
| 6 |
# - a generated column is based on a generated column # |
| 7 |
# - a "real" column on which a generated one is renamed/dropped # |
| 8 |
# - a generated column involved in partitioning is renamed/dropped # |
| 9 |
# # |
| 10 |
#------------------------------------------------------------------------------# |
| 11 |
# Original Author: Andrey Zhakov # |
| 12 |
# Original Date: 2008-09-02 # |
| 13 |
# Change Author: # |
| 14 |
# Change Date: # |
| 15 |
# Change: # |
| 16 |
################################################################################ |
| 17 |
|
| 18 |
--echo # Can't define a generated column on another generated column |
| 19 |
--error ER_VCOL_BASED_ON_VCOL |
| 20 |
create table t1 (a int, b int generated always as (a+1) virtual, c int generated always as (b+1) virtual); |
| 21 |
create table t1 (a int, b int generated always as (a+1) virtual); |
| 22 |
--error ER_VCOL_BASED_ON_VCOL |
| 23 |
alter table t1 add column c int generated always as (b+1) virtual; |
| 24 |
drop table t1; |
| 25 |
|
| 26 |
--echo # Can't rename or drop a column used in the function of a generated column |
| 27 |
create table t1 (a int, b int generated always as (a+1) virtual); |
| 28 |
--echo # On renaming/dropping a column on which a virtual field is |
| 29 |
--echo # defined the following error is displayed: |
| 30 |
--echo # "Unknown column 'a' in 'generated column function'" |
| 31 |
--error 1054 |
| 32 |
alter table t1 drop column a; |
| 33 |
--error 1054 |
| 34 |
alter table t1 change a c int; |
| 35 |
drop table t1; |
| 36 |
|
| 37 |
--echo # Can't rename or drop a generated column used by the paritition function |
| 38 |
create table t1 (a int, b int generated always as (a+1) virtual) partition by hash(b); |
| 39 |
--error 1054 |
| 40 |
alter table t1 drop b; |
| 41 |
--error 1054 |
| 42 |
alter table t1 change b c int generated always as (a+1) virtual; |
| 43 |
|