无法在架构上授予创建视图 [英] CANNOT GRANT CREATE VIEW ON SCHEMA

查看:28
本文介绍了无法在架构上授予创建视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有一个用户,他只能选择所有表上的数据.我想让他创建视图而不是表.是否可以授予特定用户仅在数据库架构中创建视图的权限?

I have a user in a database who only can select datas on all tables. I want to alow him to create views and not tables. Is it possible to grant to a specific user privileges for only creating views in a database schema?

问候.

推荐答案

在撰写本文时不在 PostgreSQL 中,没有.架构中的 CREATE 权限允许他们创建任何对象类型.没有办法限制他们可以创建的对象 - 函数、运算符、运算符类、表、视图等.

Not in PostgreSQL at time of writing, no. The CREATE right in a schema lets them create any object type. There's no way to limit what objects they can create - functions, operators, operator classes, tables, views, etc.

您可以实现一个执行程序钩子来强制执行这些类型的规则,但您必须将其作为用 C 编写的可加载模块来执行.ProcessUtility_hook 可能是您想要的钩子.这种方法将有一个重要的学习曲线,因为您需要了解 PostgreSQL 的语句是如何以其内部解析形式描述的.

You could implement an executor hook to enforce these kinds of rules, but you'll have to do it as a loadable module written in C. ProcessUtility_hook is probably the hook you want. There will be a significant learning curve to this approach, as you'll need to understand how PostgreSQL's statements are described in their internal parsed form.

这篇关于无法在架构上授予创建视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆