首页 > 解决方案 > 我们如何在 postgresql 的列表分区中存储其他值

问题描述

我们如何在 postgresql 的列表分区中存储其他值?

示例:如何在下表中为不同于 (1,2,3,4) 的值添加分区。

CREATE TABLE countrymeasurements
(
  countrycode int NOT NULL,
  countryname character varying(30) NOT NULL,
  languagename character varying (30) NOT NULL,
  daysofoperation character varying(30) NOT NULL,
  salesparts    bigint,
  replaceparts  bigint
)
PARTITION BY LIST(countrycode);
Define the partitions:

create table india 
  partition of countrymeasurements 
  for values in (1);
  
create table japan
  partition of countrymeasurements 
  for values in (2);
  
create table china
  partition of countrymeasurements 
  for values in (3);

create table malaysia
  partition of countrymeasurements 
  for values in (4);

标签: postgresql

解决方案


现在找到了解决方案:

create table dwh_user.countrymeasurements_def 
partition of countrymeasurements 
default;

推荐阅读