我在表上创建分区时出错。
建表、制定分区规则时
CREATE TABLE test_table (
id uuid NOT NULL,
last_seen timestamptz not NULL
)
PARTITION BY RANGE ("last_seen");
SELECT partman.create_parent(
p_parent_table := 'public.test_table',
p_control := 'last_seen',
p_interval := '1 day'
);
出现错误
SQL Error [42883]: ERROR: function partman.create_parent(p_parent_table => unknown, p_control => unknown, p_interval => unknown) does not exist
No function matches the given name and argument types. You might need to add explicit type casts.
请帮我看看这是什么原因?
我按照文档向我的用户授予了权限。这没有帮助
CREATE ROLE partman_user WITH LOGIN;
GRANT ALL ON SCHEMA partman TO partman_user;
GRANT ALL ON ALL TABLES IN SCHEMA partman TO partman_user;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA partman TO partman_user;
GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA partman TO partman_user;
GRANT ALL ON SCHEMA my_partition_schema TO partman_user;
我正在使用 postgresql-14
在
p_type := 'native'
函数调用中添加
partman.create_parent()
解决了问题:
SELECT partman.create_parent(
p_parent_table := 'public.test_table',
p_control := 'last_seen',
p_interval := '1 day',
p_type := 'native' --here
);