How do you perform the equivalent of Oracle's DESCRIBE TABLE
in PostgreSQL (using the psql command)?
相关问题
- Django distinct is not working
- PostgreSQL: left outer join syntax
- Connecting Python to a Heroku PostgreSQL DB?
- PostgreSQL - Deleting data that are older than an
- Does PLV8 support making http calls to other serve
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- PostgreSQL field data type for IPv4 addresses
- Using prepared statement in stored function
This variation of the query (as explained in other answers) worked for me.
It's described here in details: http://www.postgresqltutorial.com/postgresql-describe-table/
You can do that with a psql slash command:
It also works for other objects:
Source: faqs.org
In addition to the command line
\d+ <table_name>
you already found, you could also use the information-schema to look up the column data, using info_schema.columnsYou can use this :
To improve on the other answer's SQL query (which is great!), here is a revised query. It also includes constraint names, inheritance information, and a data types broken into it's constituent parts (type, length, precision, scale). It also filters out columns that have been dropped (which still exist in the database).