O'Reilly logo

PostgreSQL for Data Architects by Jayadevan Maymala

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Databases, schemas, and search_path

As per the documentation, a database is a named collection of SQL objects. It's not possible to access objects in one database from another database directly. We can access other databases using a database link (or foreign data wrappers), which is an extension, as mentioned in the previous chapter.

Tip

There are two template databases: template0 and template1 in any PostgreSQL cluster. When we create a database using CREATE DATABASE db1;, a clone of the template1 database is created. If we have a few user-created tables with some master data in template1, these will be copied to the new database. If we want to create a newdb database that is a clone of a user-created database mydb, we can use CREATE DATABASE newdb ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required