I am trying to create a partitioned table as follows:
create table archive.table1
as table work1.table1 with no data
partition by range (wk_date)
and I am getting the following error:
SQL Error [42601]: ERROR: syntax error at or near "partition"
Position: 98
CodePudding user response:
You can run the following, which is simpler and will work:
CREATE TABLE archive.table1 (LIKE work1.table1) PARTITION BY RANGE (wk_date);
CodePudding user response:
No, this is not possible.
You need to first create the partitioned table, then you need to create the partitions. Once that is done you can do an insert into partitioned_table select * from old_table