All Products
Search
Document Center

ApsaraDB for OceanBase:Incompatibilities of CREATE TABLE

Last Updated:Jun 03, 2024

This topic describes the scenarios where CREATE TABLE DDL operations performed in a MySQL database can be converted by the DDL synchronization component of the data transmission service but cannot be performed in a MySQL tenant of OceanBase Database during data migration from the MySQL database to the MySQL tenant of OceanBase Database.

Define a generated column based on other generated columns

Use other generated columns in the CREATE TABLE DDL statement to define a new generated column.

  • MySQL databases: supported.

  • MySQL tenants of OceanBase Database: not supported.

Sample code:

CREATE TABLE group_by_t1 
(a INT GENERATED ALWAYS AS (1) VIRTUAL, 
 b INT GENERATED ALWAYS AS (a) VIRTUAL, 
 c INT GENERATED ALWAYS AS (1) VIRTUAL);

Create an index or a constraint

  • When you create a constraint, the column types supported in a MySQL database are different from those supported in a MySQL tenant of OceanBase Database. For more information, see Column types that are supported to create indexes or constraints.

  • Limits on creating a FOREIGN KEY constraint:

    • MySQL tenants of OceanBase Database: The referenced column in the parent table must have the UNIQUE KEY or PRIMARY KEY constraint when you create a foreign key.

      The referenced column in the parent table is specified in the FOREIGN KEY constraint.

    • MySQL databases: The referenced column in the parent table must have a UNIQUE KEY, PRIMARY KEY, or KEY constraint when you create a foreign key.