PostgreSQL - How to list all columns?
How to list all columns in PostgreSQL?
1. Using SQL query
Using query editor, run this query to show all columns with details:
SELECT
*
FROM
information_schema.columns
WHERE
table_schema = 'schema_name'
AND table_name = 'table_name';
2. Using psql
Using psql, you can use this command:
\d+ table_name
3. Using TablePlus
In TablePlus, you can be able to see all columns from the Postgres GUI with a spreadsheet-like view.
From the data table, you can see columns with data:
Or from the database structure, you can see the list of all columns:
From the data view, you can switch to structure view by clicking on the Structure button at the bottom, or press Cmd + Ctrl + ].
Need a good GUI tool for PostgreSQL? Check out TablePlus. It’s native, beautiful, and available for free.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS.