Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL "DESCRIBE TABLE"

How do you perform the equivalent of Oracle's DESCRIBE TABLE in PostgreSQL (using the psql command)?

like image 444
Mr. Muskrat Avatar asked Sep 20 '08 20:09

Mr. Muskrat


People also ask

How do you describe a table in PostgreSQL?

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.

How do I find my PostgreSQL DESC?

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.

How do I see all tables in PostgreSQL?

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.


1 Answers

Try this (in the psql command-line tool):

\d+ tablename 

See the manual for more info.

like image 143
Chris Bunch Avatar answered Sep 21 '22 19:09

Chris Bunch