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

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.

主站蜘蛛池模板: 马山县| 长丰县| 兴仁县| 昭苏县| 介休市| 大连市| 卢龙县| 哈尔滨市| 九江市| 蕉岭县| 哈巴河县| 二连浩特市| 泰和县| 新丰县| 易门县| 宿迁市| 江阴市| 泰州市| 亳州市| 株洲市| 长春市| 西宁市| 沅陵县| 南京市| 高陵县| 兰考县| 邳州市| 天门市| 乐至县| 大厂| 汶上县| 新源县| 承德县| 婺源县| 石泉县| 通辽市| 金坛市| 河曲县| 郓城县| 靖西县| 兴义市|