How do you perform the equivalent of Oracle's DESCRIBE TABLE
in PostgreSQL (using the psql command)?
To see the description of a specific table, we add the name of that table with the “\d” command. In psql, we can get the description of the table by using a simple command. This describes each column of the table with the data type of each column.
PostgreSQL describe table is defined as check the structure of table, we can describe the structure of table by using \d and table name command in PostgreSQL. In PostgreSQL describe table statement is not present like MySQL instead of describe we have using \d table name and \d+ table name.
You should be able to just run select * from information_schema. tables to get a listing of every table being managed by Postgres for a particular database. You can also add a where table_schema = 'information_schema' to see just the tables in the information schema.
Try this (in the psql
command-line tool):
\d+ tablename
See the manual for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With