Updated on 2025-06-07 GMT+08:00

U0400013: GaussDB HASH partition keys cannot be specified in multiple columns

Description

Database Type and Version

  • Source database type and version: MySQL 5.5, 5.6, 5.7, and 8.0
  • Target database type and version: all GaussDB versions

Syntax Example

If you use KEY partitions but do not specify a partition column, the primary key of a MySQL table will be used as the partition column. If the table does not have a primary key but contains a unique index, the unique index will be used as the partition column. HASH partition keys must be specified for a GaussDB database but cannot be specified in multiple columns, for example:

CREATE TABLE partition_by_key_test (
    id INT NOT NULL,
    name VARCHAR(20),
    sid INT NOT NULL,
    UNIQUE KEY (id, sid)
) PARTITION BY HASH(id, sid) PARTITIONS 2;

This error is reported when UGO fails to convert statements in the MySQL database in which KEY partition keys are specified in multiple columns or KEY partition keys are not specified but primary or unique keys are created in multiple columns.

Suggestion

Modify Multiple columns partition key and specify the first column of the primary key or unique key as the partition key. The modification may cause inconsistent table data partitions in the source and target databases.