gpt4 book ai didi

postgresql - Postgres 11 FDW 找不到分区表

转载 作者:行者123 更新时间:2023-11-29 13:08:26 25 4
gpt4 key购买 nike

尝试使用 postgres 11 外部数据包装器访问分区表。我可以访问基础表但不能访问表。

create schema foo;

CREATE TABLE foo.test1 (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate);

CREATE TABLE foo.measurement1_y2006m02 PARTITION OF foo.test1
FOR VALUES FROM ('2006-02-01') TO ('2006-03-01');

CREATE TABLE foo.measurement1_y2006m03 PARTITION OF foo.test1
FOR VALUES FROM ('2006-03-01') TO ('2006-04-01');

insert into foo.measurement1_y2006m02 values (1,'2006-02-15',1,1);
insert into foo.measurement1_y2006m03 values (2,'2006-03-15',2,2);

select * from foo.test1;

这似乎没问题。然后我创建一个链接:

DROP SCHEMA IF EXISTS fdw_foo CASCADE;
CREATE SCHEMA fdw_foo;
IMPORT FOREIGN SCHEMA foo
FROM SERVER myserver INTO fdw_foo;

这个有效:

select * from fdw_foo.measurement1_y2006m02;

这不是

select * from fdw_foo.test1;

ERROR: relation "fdw_foo.test1" does not exist

有什么想法吗?

最佳答案

这是您应该报告的错误。

作为解决方法,您可以自己创建外部表:

CREATE FOREIGN TABLE fdw_foo.test1 (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) SERVER myserver
OPTIONS (schema_name 'foo', table_name 'test1');

关于postgresql - Postgres 11 FDW 找不到分区表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58160811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com