Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres表分区范围(按表达式)_Postgresql_Database Partitioning_Postgresql 10 - Fatal编程技术网

Postgresql Postgres表分区范围(按表达式)

Postgresql Postgres表分区范围(按表达式),postgresql,database-partitioning,postgresql-10,Postgresql,Database Partitioning,Postgresql 10,我对Postgres中的表分区还不熟悉,我尝试了一些似乎不起作用的方法。下面是问题的简化版本: cREATE table if not exists Location1 PARTITION OF "Location" FOR VALUES FROM (extract(epoch from now()::timestamp)) TO (extract(epoch from now()::timestamp)) ; insert into "Location" ("BuyerId", "L

我对Postgres中的表分区还不熟悉,我尝试了一些似乎不起作用的方法。下面是问题的简化版本:

cREATE table if not exists Location1 
PARTITION OF "Location"
FOR VALUES FROM
(extract(epoch from now()::timestamp))  
TO 
(extract(epoch from now()::timestamp)) ;

insert into "Location" ("BuyerId", "Location") 
values (416177285, point(-100, 100));
它失败于:

ERROR:  syntax error at or near "extract"
LINE 2:     FOR VALUES FROM (extract(epoch from now()::timestamp))
如果我尝试使用文本值创建分区,它就可以正常工作


我在linux上使用Postgres 10。

经过多次尝试和错误,我意识到Postgres 10并没有真正的现成完整分区系统。对于可用的分区数据库,需要安装以下postgres模块:

pg_partman(字面上是上帝的礼物)

pg_jobmon(监控pg_partman正在做什么)

以上建议是为那些新到现场,以帮助您避免很多头痛

我认为由postgres core自动创建分区是一件轻而易举的事情,但显然postgres开发人员知道一些我不知道的事情

如果要求80年代的任何关系数据库插入一行,则在通过约束检查后会成功

最新版本的2018年Postgres被要求插入一行:“对不起,我不知道放在哪里。”


这是一个很好的第一步,但希望Postgres 11将有一个合适的分区系统OOTB…

为什么不将时间戳存储为真正的
时间戳呢?这样,您就不需要使用此黑客来提取epochPlease问题并为分区表添加
createtable
语句