How do I get the types of columns for postgresql?
Based on the query you already have,

SELECT (SELECT data_type
               FROM information_schema.columns
               WHERE table_schema = 'public'
                     AND table_name = 'table_name'
                     AND column_name = 'name') "name",
       (SELECT data_type
               FROM information_schema.columns
               WHERE table_schema = 'public'
                     AND table_name = 'table_name'
                     AND column_name = 'id') "id";


would produce the output you want (but only a single row, which is enough per your comment).

SQL Fiddle