-1

enter image description here And I want to know the details about template0 and template1 database

Vaitheeswaran
  • 87
  • 1
  • 2
  • 13
  • Read the docs here [psql](https://www.postgresql.org/docs/current/app-psql.html) under the section *Meta-Commands*. Or in `psql` do `\?` to get brief descriptions of commands. – Adrian Klaver Jan 29 '23 at 16:36

1 Answers1

1
\l

Lists the databases. You can also run \list with similar results. See the documentation.

\d

stands for describe and shows the list of tables and other relations in the database.

Basically you need to switch to the database of your interest first, via running

\c template0

or

\c template1

depending where you want to connect and then run

\d

to list the tables in the current database. Since you do not specify a pattern in the above, it will display everything.

enter image description here

Now, if you are interested to see table structures, run \d tablename

Running

\dt+ *.*

will display all tables.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175