سؤال

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?

Regards.

هل كانت مفيدة؟

المحلول

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.

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top