\d
For each relation (table, view, materialized view, index, sequence, or foreign table) or composite type matching the pattern , show all columns, their types, the tablespace (if not the default) and any special attributes such as NOT NULL or defaults. Associated indexes, constraints, rules, and triggers are also shown. For foreign tables, the associated foreign server is shown as well. ( “ Matching the pattern ” is defined in Patterns below.)
Reading PG 18·Select a recorded version
- Client
- psql 18.7
- Case-sensitive spelling
- \d
- command
- \d
- manual path
- app-psql.html#APP-PSQL-META-COMMAND-D
- modifiers
- map[command:\d modifiers:Sx+]
- signature
- \d[Sx+] [ pattern ]
- spellings
- \d
Definition PG 18
\d[Sx+] [pattern]For each relation (table, view, materialized view, index, sequence, or foreign table) or composite type matching the
pattern, show all columns, their types, the tablespace (if not the default) and any special attributes such asNOT NULLor defaults. Associated indexes, constraints, rules, and triggers are also shown. For foreign tables, the associated foreign server is shown as well. (“Matching the pattern” is defined in Patterns below.)For some types of relation,
\dshows additional information for each column: column values for sequences, indexed expressions for indexes, and foreign data wrapper options for foreign tables.The command form
\d+is identical, except that more information is displayed: any comments associated with the columns of the table are shown, as is the presence of OIDs in the table, the view definition if the relation is a view, a non-default replica identity setting and the access method name if the relation has an access method.By default, only user-created objects are shown; supply a pattern or the
Smodifier to include system objects.Note
If
\dis used without apatternargument, it is equivalent to\dtvmsEwhich will show a list of all visible tables, views, materialized views, sequences and foreign tables. This is purely a convenience measure.As with many other commands, if
xis appended to the command name, the results are displayed in expanded mode for this command only, but note that this only applies when\dis used without apatternargument or to describe a sequence. The same limitation on expanded output applies to\x onand\x auto. Thexmodifier cannot appear immediately after the\d(because\dxis a different command); thexmodifier may only appear after anSor+modifier. For example,\d+xis equivalent to\dtvmsE+xand will show a list of all relations in expanded mode.
Exact case-sensitive spellings
\d
Spellings in this manual definition
| Command | Documented suffix modifiers |
|---|---|
| \d | Sx+ |
Compare versions
Complete source facts
documentation revision
{"inputs":[{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","version":"18.7"},{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"cb475c53a16d9e06358f5e6c9c5649645db92568cfd319f230c62c9f57ae090b","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · 1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915
Text language: en · 1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915