Updated on 2026-07-15 GMT+08:00

U0100067: CREATE TABLE AS cannot be used to create partitioned tables in GaussDB

Description

In GaussDB, CREATE TABLE AS cannot be used to create partitioned tables.

Database Type and Version

  • Source database type and version: Oracle versions supported by UGO
  • Target database type and version: GaussDB of versions earlier than V2.0-8.100

Syntax Example

CREATE TABLE sales_interval_part
PARTITION BY RANGE (sale_date)
INTERVAL ('1 MONTH')
(
    PARTITION p_hist VALUES LESS THAN (TO_DATE('2023-01-01', 'YYYY-MM-DD'))
)
AS
SELECT sale_id, sale_date, product_id, region, amount
FROM sales_source
WHERE sale_date >= DATE '2023-01-01';

Suggestion

Create a partitioned table and then insert data using INSERT INTO SELECT.

Modified SQL statements compatible with GaussDB:

 CREATE TABLE sales_interval_part (                                                 
     sale_id numeric,                                                               
     sale_date timestamp without time zone,                                         
     product_id text,                                                               
     region text,                                                                   
     amount numeric                                                                 
 )                                                                                         
 PARTITION BY RANGE (sale_date)                                                     
 INTERVAL ('1 mon')                                                                 
 (                                                                                  
     PARTITION p_hist VALUES LESS THAN ('2023-01-01 00:00:00') TABLESPACE pg_default
 );   
insert into sales_interval_part SELECT sale_id, sale_date, product_id, region, amount
FROM sales_source
WHERE sale_date >= DATE '2023-01-01';