官术网_书友最值得收藏!

Schema usages

Schemas are used for the following reasons:

  • Control authorization: In a multi-user database environment, you can use schemas to group objects based on roles.
  • Organize database objects: You can organize the database objects in groups based on business logic. For example, historical and auditing data could be logically grouped and organized in a specific schema.
  • Maintain third-party SQL code: The extensions available in the contribution package can be used with several applications. Maintaining these extensions in separate schemas enables the developer to reuse these extensions and to update them easily.

In the car web portal, let's assume that we would like to create a schema named car_portal_app, owned by the car_portal_app role. This can be done as follows:

CREATE SCHEMA car_portal_app AUTHORIZATION car_portal_app;

The schema owner is the same as the schema name, if not provided:

CREATE SCHEMA AUTHORIZATION car_portal_app;

For more information about the syntax of the CREATE SCHEMA command, you can use the psql \h meta-command, which displays the psql client tool's inline help, or take a look at the PostgreSQL manual at http://www.postgresql.org/docs/current/static/sql-createschema.html.

主站蜘蛛池模板: 乃东县| 临夏市| 山西省| 内黄县| 黄冈市| 姜堰市| 健康| 大厂| 永嘉县| 大洼县| 迁西县| 兴城市| 阿克陶县| 肥西县| 恩施市| 黔江区| 尼勒克县| 玉门市| 延寿县| 竹山县| 池州市| 东城区| 得荣县| 泰宁县| 安陆市| 永川市| 靖安县| 三河市| 龙山县| 高邑县| 阳高县| 扶沟县| 宝鸡市| 高青县| 锡林浩特市| 喀喇沁旗| 航空| 南丰县| 永兴县| 资溪县| 南丹县|