postgresql - Postgres 12 中的列表分区
问题描述
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)
(
partition india values(1),
partition japan values(2),
partition china values(3),
partition malaysia values(4)
);
我收到错误:“(”或附近的语法错误。我在这里缺少什么。我正在使用 postgres12
解决方案
我不知道您在哪里找到该语法,显然不在手册中。如您所见,create table .. as partition of
在 Postgres中创建了分区:
定义表:
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);
定义分区:
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);
推荐阅读
- react-native - React Native 文本和图像并排对齐问题
- netlogo - 如何在 NetLogo 中改变随机海龟的颜色
- java - SpEL Spring中的三元运算符
- c# - Windows 身份验证:用户 'DOMAIN\MACHINE$' 登录失败
- android - Android 推送通知与 Firebase 推送通知
- mysql - 是否可以使用 mysql_user ansible 模块删除 mysql root 用户进行远程登录?
- java - 当参数是给定类型的子类时如何调用重载方法?
- amazon-web-services - 字体未从 aws s3 加载(400 错误请求)
- php - PHP / htaccess中带有正斜杠的GET参数
- react-native - Metro bundler 不会随着 expo start 自动启动