Greenplum管理模式
Greenplum管理模式
这个和oracle schema一样的用途,用来逻辑组织数据库对象的存放容器,不同schema不共享命名空间。schema public是在创建数据库之后就会默认创建的,每个用户都有权限在这个schema创建对象,如果不指定schema那么就会默认创建到这里。创建schema后最好需要修改默认的搜索路径,否则每次登陆都必须指定路径才能使用创建的schema。
gtlions=# create schema gtlions authorization gtlions;
CREATE SCHEMA
gtlions=# alter role gtlions set search_path=gtlions;
ALTER ROLE
gtlions=# \dn
List of schemas
Name | Owner
--------------------+---------
gp_toolkit | gpadmin
gtlions | gtlions
information_schema | gpadmin
pg_aoseg | gpadmin
pg_bitmapindex | gpadmin
pg_catalog | gpadmin
pg_toast | gpadmin
public | gpadmin
(8 rows)
gtlions=# show search_paht;
ERROR: unrecognized configuration parameter "search_paht"
gtlions=# show search_path;
search_path
-------------
gtlions
(1 row)
gtlions=# select current_schema();
current_schema
----------------
gtlions
(1 row)
gtlions=# select * from pg_namespace;
nspname | nspowner | nspacl
--------------------+----------+----------------------------------
gp_toolkit | 10 | {gpadmin=UC/gpadmin,=U/gpadmin}
pg_toast | 10 |
pg_bitmapindex | 10 |
gtlions | 98690 |
pg_aoseg | 10 |
pg_catalog | 10 | {gpadmin=UC/gpadmin,=U/gpadmin}
public | 10 | {gpadmin=UC/gpadmin,=UC/gpadmin}
information_schema | 10 | {gpadmin=UC/gpadmin,=U/gpadmin}
(8 rows)
-EOF-