PostgreSQL - 错误:序列

时间:2018-06-05 15:42:54

标签: database postgresql sequence

是否可以允许用户在模式中创建序列而不允许他创建表,函数,存储过程等?

这是我目前的SQL命令集:

   REVOKE ALL ON SCHEMA sales FROM sales_user;
   REVOKE ALL ON ALL TABLES IN SCHEMA sales FROM sales_user;
   REVOKE ALL ON ALL SEQUENCES IN SCHEMA sales FROM sales_user;
   REVOKE ALL ON ALL FUNCTIONS IN SCHEMA sales FROM sales_user;

   GRANT USAGE ON SCHEMA sales TO sales_user;
   GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA sales TO sales_user;
   GRANT SELECT, UPDATE ON ALL SEQUENCES IN SCHEMA sales TO sales_user;
>> GRANT CREATE ON ALL SEQUENCES IN SCHEMA sales TO sales_user;
   GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA sales TO sales_user;

一切运作良好,但标记的行会生成

ERROR:  invalid privilege type CREATE for sequence

感谢。

1 个答案:

答案 0 :(得分:1)

PostgreSQL中没有授予或拒绝创建某些对象的权限。

您需要的只是架构的CREATE权限,然后您可以在该架构中创建任何所需的内容。

所以没有办法达到你想要的效果。