How do you perform the equivalent of Oracle's DESCRIBE TABLE
in PostgreSQL (using the psql command)?
|
||||
|
|
|||||||||||||
|
I'm new to psql, but just discovered you may do a \d *search pattern * with asterisks to find tables that match the search pattern you're interested in. |
|||
|
If you want to obtain it from query instead of psql, you can query the catalog schema. Here's a complex query that does that:
It's pretty complex but it does show you the power and flexibility of the PostgreSQL system catalog and should get you on your way to pg_catalog mastery ;-). Be sure to change out the %s's in the query. The first is Schema and the second is the table name. |
||||
|
Is it possible to do: \dt LIKE '%some_table_name%'. I know all these combination will work if you know the full string or want to list all tables, sequences or indexes. - \dt - List all tables - \d - List tables, sequences, indexes, views - \d+ - same as above - \ds - List all sequences - \di - List all indexes |
|||
|
In addition to the PostgreSQL way (\d 'something' or \dt 'table' or \ds 'sequence' and so on) The SQL standard way, as shown here:
It's supported by many db engines. |
|||||||||||||||
|
It looks like you can do that with a psql slash command:
|
|||
|
The psql equivalent of "DESCRIBE TABLE" is "\d table". See the psql portion of the PostgreSQL manual for more details. |
|||
|