PG查找表中的所有显式字段


postgres=# d test
                       Table "public.test"
 Column |         Type          | Collation | Nullable | Default
--------+-----------------------+-----------+----------+---------
 id     | integer               |           |          |
 name   | character varying(20) |           |          |

postgres=# SELECT attname FROM pg_attribute where attrelid='test'::regclass and attname not in ('cmax','cmin','ctid', 'xmax','xmin','tableoid');
 attname
---------
 id
 name
(2 rows)

原文地址:https://www.cnblogs.com/yldf/p/11899972.html