SELECT a.attnum AS "Номер",
a.attname AS "Поле",
pg_catalog.format_type(a.atttypid, a.atttypmod) AS "Тип"
FROM pg_catalog.pg_attribute a
WHERE a.attrelid = (
SELECT c.oid FROM pg_catalog.pg_class AS c
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
WHERE pg_catalog.pg_table_is_visible(c.oid)
AND c.relname = 'A' -- вместо A подставляем имя нужной таблицы
)
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum