postgresql db。两个模式1. base_layers 2. how
每个都有自己唯一的登录名(不是超级用户)
我非常简单地尝试从base_layers连接sql窗口的how模式中的表中创建base_layers模式中的表
我跑这个
GRANT ALL ON SCHEMA base_layers TO how;
create table base_layers.man as
select * from how.hl_boundary
它给了我这个错误
ERROR: permission denied for relation hl_boundary
********** Error **********
ERROR: permission denied for relation hl_boundary
SQL state: 42501
然而,当我通过postgres SQL连接窗口运行相同的查询时,它正确地在base_layers模式中创建了这个表...
我需要为base_layers连接做什么SQL窗口能够从另一个模式创建表
架构如何
-- Schema: how
-- DROP SCHEMA how;
CREATE SCHEMA how
AUTHORIZATION how;
GRANT ALL ON SCHEMA how TO how;
GRANT USAGE ON SCHEMA how TO public;
GRANT ALL ON SCHEMA how TO base_layers;
ALTER DEFAULT PRIVILEGES IN SCHEMA how
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO base_layers;
base_layers架构
-- Schema: base_layers
-- DROP SCHEMA base_layers;
CREATE SCHEMA base_layers
AUTHORIZATION base_layers;
GRANT ALL ON SCHEMA base_layers TO base_layers;
GRANT USAGE ON SCHEMA base_layers TO public;
GRANT ALL ON SCHEMA base_layers TO how;
ALTER DEFAULT PRIVILEGES IN SCHEMA base_layers
GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES
TO public;
答案 0 :(得分:0)
您需要将该表的select权限授予用户,如下所示:
GRANT SELECT ON TABLE hl_boundary TO [user];
将[user]
替换为您正在运行此命令的用户。