And I want to know the details about template0 and template1 database
Asked
Active
Viewed 135 times
-1

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 Answers
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.
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
-
You should not be using a link to 10 years past EOL version of Postgres(8.3). A lot has changed in that time. – Adrian Klaver Jan 29 '23 at 16:38
-
-
That went EOL in November 2022. Go here [Docs](https://www.postgresql.org/docs/current/index.html) to see what is supported. Hint you want `Current`. – Adrian Klaver Jan 29 '23 at 17:26
-