How to do it...

  1.  Schemas can be easily created using the following commands:
        CREATE SCHEMA finance;        CREATE SCHEMA sales;
  1. We can then create objects directly within those schemas using fully qualified names, like this:
        CREATE TABLE finance.month_end_snapshot (.....)

The default schema in which an object is created is known as the current_schema. We can find out which is our current schema using the following query:

        postgres=# select current_schema;

This returns an output like the following:

         current_schema        ----------------         public        (1 row)
  1. When we access database objects, we use the user-settable search_path parameter to identify the schemas to search. The current_schema is the first schema in the search_path parameter. There is ...

Get PostgreSQL Administration Cookbook, 9.5/9.6 Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.