为什么所有数据库在 PostgreSQL 中都有一个公共模式?

编程入门 行业动态 更新时间:2024-10-24 00:32:12
本文介绍了为什么所有数据库在 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 中都有一个公共模式?

本文发布于:2023-10-17 13:02:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500987.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中都   有一个   模式   数据库   PostgreSQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!