查询授予Postgres中序列的GRANTS [英] Query GRANTS granted to a sequence in postgres

查看:100
本文介绍了查询授予Postgres中序列的GRANTS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要查询授予表的GRANTS,可以使用以下查询:

To query GRANTS granted to a table I can use a query like:

SELECT grantee, privilege_type 
FROM information_schema.role_table_grants 
WHERE table_name='mytable'

(请参阅此处的旧问题:< a href = https://stackoverflow.com/questions/7336413/query-grants-for-a-table-in-postgres>查询在postgres中的表的授权)

(see my old question here: Query grants for a table in postgres)

但是我如何查询磨碎为序列的GRANTS?

But how I query the GRANTS grated to a sequence?

推荐答案

我已经浏览了源代码,我找不到任何地方可以通过information_schema表公开序列的ACL。 (虽然我可能会错过一些东西。)

I've looked through the source code, and I can't find any place that exposes the ACL for sequences through the information_schema tables. (I could have missed something, though.)

PostgreSQL确实公开了系统目录pg_class中序列的ACL。

PostgreSQL does expose the ACL for sequences in the system catalog pg_class.

SELECT relname, relacl
FROM pg_class
WHERE relkind = 'S'
  AND relacl is not null
  AND relnamespace IN (
      SELECT oid
      FROM pg_namespace
      WHERE nspname NOT LIKE 'pg_%'
        AND nspname != 'information_schema'
);

就information_schema和标准SQL序列而言,PostgreSQL不支持它们。

As far as the information_schema and standard SQL sequences go, PostgreSQL doesn't support them.

select feature_name, is_supported 
from information_schema.sql_features
where feature_name = 'Sequence generator support';

PostgreSQL在这方面是不合格的,因为它公开了information_schema.sequences而没有为 Sequence返回 YES发电机支持。 (这是一个观察,并不是对PostgreSQL的批评。)

PostgreSQL is nonconforming in that respect, because it exposes information_schema.sequences without returning "YES" for 'Sequence generator support'. (That's an observation, not a criticism of PostgreSQL.)

但是,说了这么多,我在2003 SQL标准中找不到任何暴露这些特权的内容,要么。在ROLE_TABLE_GRANTS视图的定义中很容易找到PRIVILEGE_TYPE,但是据我所知,标准中的序列没有类似的东西。

But, having said all that, I couldn't find anything in the 2003 SQL standard that exposed those privileges, either. It's easy to find PRIVILEGE_TYPE in the definition of the ROLE_TABLE_GRANTS view, but there's nothing like that for sequences in the standard, as far as I can tell.

这篇关于查询授予Postgres中序列的GRANTS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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