逻辑分区表 CREATE TABLE tnativerangedefault PARTITION OF tnativerange DEFAULT; CREATE TABLE teledb insert into tnativerange values(1,'20160901',1); INSERT 0 1 list分区表 创建主分区 plaintext teledb create table tnativelist(f1 bigserial not null,f2 text, f3 integer,f4 date) partition by list( f2 ) distribute by shard(f1); CREATE TABLE 建立两个子表,分别存入“广东”和“北京” plaintext teledb create table tlistgd partition of tnativelist(f1 ,f2 , f3,f4) for values in ('广东'); CREATE TABLE teledb create table tlistbj partition of tnativelist(f1 ,f2 , f3,f4) for values in ('北京'); CREATE TABLE 看表结构 plaintext teledb d+ tnativelist Table "public.tnativelist" Column Type Collation Nullable Default Storage Stats target Description ++++++ + f1 bigint not null nextval('tnativelistf1seq'::regclass) plain f2 text extended f3 integer plain f4 timestamp(0) without time zone plain Partition key: LIST (f2) Partitions: tlistbj FOR VALUES IN ('北京'), tlistgd FOR VALUES IN ('广东') Distribute By: SHARD(f1) Location Nodes: ALL DATANODES 创建default 分区 没有default 分区情况下会出错,插入会出错。 plaintext teledb insert into tnativelist values(1,'上海',1,currentdate); ERROR: node:dn01, backendpid:40092, nodename:dn01,backendpid:40092,message:no partition of relation "tnativelist" found for row DETAIL: Partition key of the failing row contains (f2) (上海). 创建后就能正常插入。 plaintext teledb