(选择PostgreSQL 11.6,由Visual C ++ build 1800 64位编译)
我创建了一个新用户:
create user bob with password 'some_password_string';
我在一个名为“ GoogleData”的数据库中:
grant all privileges on GoogleData to bob;
SQL Error [42P01]: ERROR: relation "googledata" does not exist
例如,我可以通过指定schema.table将bob添加到GoogleData中的特定表中。
grant all privileges on reporting.ecom_dashboard to bob;
那行得通,除了有太多的表无法一一授予访问权限。我也无法授予公众访问权限。
尝试:
grant all privileges on public to bob;
SQL Error [42P01]: ERROR: relation "public" does not exist
尝试遍历特定模式,如下所示:
grant all privileges on reporting.* to bob;
SQL Error [42601]: ERROR: syntax error at or near "to"
Position: 46
grant all privileges on schema_name.* to bob;
授予bob特权?答案 0 :(得分:1)
如何在架构级别授予bob特权
您正在寻找选项on all tables in schema
grant all privileges on all tables in schema public to bob;
grant all privileges on all tables in schema reporting to bob;
您可能还想change the default privileges,以便将来也可以将其应用于表。