PostgreSQL – View all columns of a table

You can query the system catalog table ‘columns’ to view all the columns of a table and their data types as below:

SELECT column_name, data_type from information_schema.columns where table_schema='your_schema' and table_name='your_table_name';

See also  PostgreSQL - Export output to a csv file