支持不同父表下相同的子表名称

最近更新时间: 2025-02-18 16:02:00

  • 分区表1。
  • 复制
    复制成功
postgres=# create table t_same_child_partition_name_1 (f1 bigint,f2 timestamp default now(), f3 integer) partition by range ( f2 ) distribute by shard(f1) to group default_group; 
CREATE TABLE
postgres=# create table t_same_child_partition_name_1_201709 partition of t_same_child_partition_name_1  for values from ('2017-09-01') to ('2017-10-01') as part_1;
CREATE TABLE
postgres=# insert into t_same_child_partition_name_1 values(1,'2017-09-01',1);
INSERT 0 1
  • 分区表2。
  • 复制
    复制成功
postgres=# create table t_same_child_partition_name_2 (f1 bigint,f2 timestamp default now(), f3 integer) partition by range ( f2 ) distribute by shard(f1) to group default_group; 
CREATE TABLE
postgres=# 
postgres=# create table t_same_child_partition_name_2_201709 partition of t_same_child_partition_name_2  for values from ('2017-09-01') to ('2017-10-01') as part_1;
CREATE TABLE
postgres=#
postgres=# insert into t_same_child_partition_name_2 values(1,'2017-09-01',1);
INSERT 0 1
postgres=#
  • 查询。
  • 复制
    复制成功
postgres=# select * from t_same_child_partition_name_1 partition(part_1);
 f1 |         f2          | f3 
----+---------------------+----
  1 | 2017-09-01 00:00:00 |  1
(1 row)

postgres=# select * from t_same_child_partition_name_2 partition(part_1);
 f1 |         f2          | f3 
----+---------------------+----
  1 | 2017-09-01 00:00:00 |  1
(1 row)
postgres=#