stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
862 stars 139 forks source link

feature: Create errors, b int as (a+3) is not supported #960

Open shangyanwen opened 1 year ago

shangyanwen commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

create table t (a int, b int as (a+3))engine=tianmu;
ERROR 3106 (HY000): 'Specified storage engine' is not supported for generated columns.

Expected behavior

MySQL(innodb) results:

mysql> create table t (a int, b int as (a+3))engine=innodb;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t(a) values(1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t;
+------+------+
| a    | b    |
+------+------+
|    1 |    4 |
+------+------+
1 row in set (0.00 sec)

How To Reproduce

create table t (a int, b int as (a+3))engine=tianmu;

Environment

root@ub01:/stonedb57/install/bin# ./mysql --version
./mysql  Ver 14.14 Distrib 5.7.36-StoneDB, for Linux (x86_64) using  EditLine wrapper

#notes:v1.2.2

Are you interested in submitting a PR to solve the problem?

davidshiz commented 1 year ago

Other similar test scenarios Nongenerated columns alter to generated columns is not supported

CREATE TABLE t1 (c1 INT, c2 INT);
ALTER TABLE t1 MODIFY COLUMN c2 INT GENERATED ALWAYS AS (c1 + 1) STORED;