| 1 |
DROP TABLE IF EXISTS t1; |
| 2 |
CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; |
| 3 |
SHOW COLUMNS IN t1; |
| 4 |
Field Type Null Key Default Extra |
| 5 |
a int(11) # # |
| 6 |
b int(11) # # VIRTUAL GENERATED |
| 7 |
INSERT INTO t1 (a) VALUES (1),(2); |
| 8 |
INSERT INTO t1 (a,b) VALUES (3,3),(4,4); |
| 9 |
Warnings: |
| 10 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 11 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 12 |
SELECT a,b FROM t1; |
| 13 |
a b |
| 14 |
1 2 |
| 15 |
2 3 |
| 16 |
3 4 |
| 17 |
4 5 |
| 18 |
DROP TABLE t1; |
| 19 |
CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; |
| 20 |
SHOW COLUMNS IN t1; |
| 21 |
Field Type Null Key Default Extra |
| 22 |
a int(11) # # |
| 23 |
b int(11) # # STORED GENERATED |
| 24 |
INSERT INTO t1 (a) VALUES (1),(2); |
| 25 |
INSERT INTO t1 (a,b) VALUES (3,3),(4,4); |
| 26 |
Warnings: |
| 27 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 28 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 29 |
SELECT a,b FROM t1; |
| 30 |
a b |
| 31 |
1 2 |
| 32 |
2 3 |
| 33 |
3 4 |
| 34 |
4 5 |
| 35 |
DROP TABLE t1; |
| 36 |
CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; |
| 37 |
SHOW COLUMNS IN t1; |
| 38 |
Field Type Null Key Default Extra |
| 39 |
a int(11) # # |
| 40 |
b int(11) # # VIRTUAL GENERATED |
| 41 |
INSERT INTO t1 (a) VALUES (1),(2); |
| 42 |
INSERT INTO t1 (a,b) VALUES (3,3),(4,4); |
| 43 |
Warnings: |
| 44 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 45 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 46 |
SELECT a,b FROM t1; |
| 47 |
a b |
| 48 |
1 2 |
| 49 |
2 3 |
| 50 |
3 4 |
| 51 |
4 5 |
| 52 |
DROP TABLE t1; |
| 53 |
CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>; |
| 54 |
SHOW COLUMNS IN t1; |
| 55 |
Field Type Null Key Default Extra |
| 56 |
a int(11) # # |
| 57 |
b int(11) # # STORED GENERATED |
| 58 |
INSERT INTO t1 (a) VALUES (1),(2); |
| 59 |
INSERT INTO t1 (a,b) VALUES (3,3),(4,4); |
| 60 |
Warnings: |
| 61 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 62 |
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored |
| 63 |
SELECT a,b FROM t1; |
| 64 |
a b |
| 65 |
1 2 |
| 66 |
2 3 |
| 67 |
3 4 |
| 68 |
4 5 |
| 69 |
DROP TABLE t1; |