为什么所有数据库在 PostgreSQL 中都有一个公共模式? [英] Why do all databases have a public schema in PostgreSQL?

查看:73
本文介绍了为什么所有数据库在 PostgreSQL 中都有一个公共模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇为什么 PostgreSQL 中的所有数据库都有一个所有用户都可以访问的 public 模式.我知道我可以撤销权限并将其授予一个用户,但为什么这不是默认设置?

I was just curious why all databases in PostgreSQL have a public schema that is accessible to all users. I know I can revoke privileges and grant them to one user but why is that not the default?

推荐答案

没有给出太多理由,但请参阅部分 [5.7.6][1] 在手册中,但我认为以下内容可以回答您的问题:

There isn't much justification given, but see section [5.7.6][1] in the manual, but I think the following answers your question:

如果您不创建任何架构,则所有用户都会隐式访问公共架构.这模拟了模式根本不可用的情况.当数据库中只有一个用户或几个合作用户时,主要推荐使用此设置.此设置还允许从非架构感知世界平滑过渡.

If you do not create any schemas then all users access the public schema implicitly. This simulates the situation where schemas are not available at all. This setup is mainly recommended when there is only a single user or a few cooperating users in a database. This setup also allows smooth transition from the non-schema-aware world.

这篇关于为什么所有数据库在 PostgreSQL 中都有一个公共模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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