With the following query, we can get a list of column names and datatype of a table in PostgreSQL.
SELECT column_name,data_type FROM information_schema.columns WHERE table_name = 'your_table_name' AND table_catalog = 'your_database_name' AND table_schema = 'your_schema_name';