3 ways to List All Schemas from PostgreSQL



1.Using SQL Syntax

There are two ways in which you can use the SQL Synthax to list all schemas from PostgreSQL.

Using the (ANSI) standard INFORMATION_SCHEMA:

 SELECT schema_name
 FROM information_schema.schemata;

Another option is

 SELECT nspname
 FROM pg_catalog.pg_namespace;

2.Using psql

In psql all schemas can be listed by executing the next command:

 /dn

You can find a cheat sheet of the important commands in psql here

3.Using DbSchema

DbSchema is a PostgreSQL client and visual designer. DbSchema can be downloaded for free. No registration is required.

In DbSchema you don’t have to run any query to see the full list of your PostgreSQL database. The tables are shown in the left menu. From there, you can drag them to the layout to edit or browse.

dbschema show tables

DbSchema includes further features, which allows to:

  • Design the schema in team and deploy the schema on multiple databases
  • Export HTML5 database documentation
  • Visually explore the database data
  • Build queries using the mouse
  • Query editor
  • Random data generator
  • Data loader

Share this blog post on Twitter, Facebook, and LinkedIn