SELECT
a.attname AS column_name,
format_type(a.atttypid, a.atttypmod) AS data_type,
CASE WHEN a.attnotnull THEN 'NOT NULL' ELSE '' END AS constraints,
col_description(a.attrelid, a.attnum) AS column_description
FROM
pg_class c
JOIN
pg_attribute a ON a.attrelid = c.oid
JOIN
pg_namespace n ON c.relnamespace = n.oid
WHERE
c.relname = 'biaoming' -- 替换为你的表名
AND n.nspname = 'moshiming' -- 替换为你的 schema 名称
AND a.attnum > 0
ORDER BY
a.attnum;
工作常用语句-kingbase数据库
于 2024-05-21 17:18:03 首次发布