pg_user是视图还是目录? [英] Is `pg_user` a view or a catalog?

查看:215
本文介绍了pg_user是视图还是目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 https://www.postgresql.org/ docs / 9.5 / static / view-pg-user.html 在系统目录下


视图 pg_user提供对数据库用户信息的访问。这只是pg_shadow的公共可读视图,该视图空白了密码字段。

The view pg_user provides access to information about database users. This is simply a publicly readable view of pg_shadow that blanks out the password field.

pg_user 视图还是目录?


  • pg_user 是在postgresq手册的系统目录下进行了介绍,这似乎表明 pg_user 是目录/数据库。 (
    我是否正确认为目录与数据库的概念相同?(我从一篇极受好评的帖子中了解到)?)

  • pg_user is described under "System Catalogs" in the postgresq manual, which seems to suggest pg_user is a catalog/database. ( Am I correct that a catalog is the same concept as a database? (I learned this from a highly upvoted post)?)

但是引号调用 pg_user 视图。哪个数据库的视图是 pg_user ?我没有在链接中找到答案,但是我已经看到 pg_catalog.pg_user 可行。但是 pg_catalog 不是目录或数据库,而是任何数据库的架构。

But the quote calls pg_user a view. Which database's view is pg_user? I didn't find the answer in the link, but I have seen pg_catalog.pg_user works. But pg_catalog is not a catalog or database, but a schema of any database.

谢谢。

推荐答案

不幸的是,所有这些术语都已超载。

Unfortunately all of these terms are overloaded.

就像模式既可以是名称空间本身,也可以是该名称空间内存在的所有对象的定义。

It is like how a 'schema' can be either the namespace itself, or the definition of all of the objects which exist inside that namespace.

目录要么是数据库本身(这是SQL标准委员会采用的术语,但每个人似乎都后悔),或者它是一个表

A 'catalog' is either the database itself (which is a terminology adopted by the SQL standards committee, which everyone but them seems to regret), or it is a table or view which lets you introspect into the structure of that database.

因此,视图描述了其实现,而目录描述了其目的。

So 'view' describes its implementation, while 'catalog' describes its purpose.

在这种情况下,由于pg_user是共享目录(或者至少是在共享目录表上的视图),因此更加令人困惑。它是在群集中的所有数据库之间共享的,因为不是按数据库创建PostgreSQL用户,而是在整个群集范围内。

In this case it is a bit more confusing because pg_user is a shared catalog (or at least, it is view over shared catalog tables). It is shared between all the databases in the cluster, as PostgreSQL users are not created per-database but are cluster-wide.

这篇关于pg_user是视图还是目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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