liveBook · Manning

\d command

As explained in Just Use Postgres!

The psql \d command lists tables, views, and sequences in the connected database.

The psql \d meta-command lists tables, views, and sequences in the connected database. It provides a quick check of which relations are currently visible. section 1.4

Inspect the connected database

Run \d at the psql prompt. A fresh database may respond with “Did not find any relations.” After creating products.catalog and products.reviews, the listing includes both tables and their catalog_id_seq and reviews_id_seq sequences. If expected objects are missing, set the schema with SET search_path TO products; and run \d again, or use \dts products.*. section 2.1.3 section 1.4

\d

                List of relations
  Schema  |      Name       |   Type   |  Owner
----------+-----------------+----------+----------
 products | catalog         | table    | postgres
 products | catalog_id_seq  | sequence | postgres
 products | reviews         | table    | postgres
 products | reviews_id_seq  | sequence | postgres
(4 rows)

Shows the resulting relation list, including schemas, object names, relation types, and owners. section 2.1.3

How Just Use Postgres! covers it

How deep it goes
Explains the listing and schema-visibility caveat, but stops short of catalog internals or exhaustive meta-command options.
Examples
Uses empty-database output and a products schema containing catalog, reviews, and their identifier sequences.
What it assumes
Assumes a psql connection and basic database familiarity while demonstrating behavior from an empty database.
What you can do after
Operate psql to verify visible relations and troubleshoot missing objects by changing the current schema.
How it connects
Connects psql with databases, schemas, tables, views, sequences, and the search_path setting.

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.