PostgreSQL学习篇10.1 模式

来源:互联网 发布:机器人编程指令 编辑:程序博客网 时间:2024/06/05 18:32
模式(schema)是数据库中的一个概念,可以将其理解为一个命名空间或目录。在PG中,一个数据库包含一个或者多个模式,模式中又包含了表、函数及操作符等数据库对象。在PG中,不能同时访问不同数据库中的对象,当要访问另一个数据库中的表或其他对象时,需要重新连接到这个新的数据库,而模式没有此限制。模式创建:create schema sch_name [authorization user_name]postgres=# create schema test;CREATE SCHEMApostgres=# \dn  List of schemas  Name  |  Owner   --------+---------- public | postgres test   | postgres(2 rows)postgres=# drop schema test;DROP SCHEMApostgres=# \dn  List of schemas  Name  |  Owner   --------+---------- public | postgres(1 row)postgres=#postgres=# show search_path;   search_path   ----------------- "$user", public(1 row)postgres=# 

0 0
原创粉丝点击