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

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.

主站蜘蛛池模板: 河源市| 长武县| 徐州市| 西乌珠穆沁旗| 武宁县| 兴安盟| 荃湾区| 姚安县| 宁国市| 大名县| 深圳市| 辽中县| 巩义市| 阜宁县| 台山市| 城市| 铜陵市| 礼泉县| 大兴区| 翁牛特旗| 简阳市| 秦皇岛市| 黄石市| 仁化县| 大新县| 武威市| 哈密市| 鄂伦春自治旗| 芜湖市| 昌宁县| 宁夏| 黔江区| 都安| 灵寿县| 化州市| 岢岚县| 深州市| 印江| 稻城县| 博白县| 开封市|