postgresql 查询包含某字段的表

查询包含某字段的表都有哪些

查询SQL如下:

SELECT
    b.oid,
    b.relname,
    att.attname,
    b.relkind,
    attinhcount,
    atttypmod 
FROM
    pg_attribute att,
    pg_class b 
WHERE
    b.oid = att.attrelid 
    AND att.attname = 'user_name' --可以模糊查询 '%column_name%'
    AND attinhcount IN ( 0 ) 
    AND b.relkind IN ( 'r' ) 
ORDER BY
    b.relname,
    atttypmod;

 

上一篇:词频junit测试


下一篇:PostgreSQL数据库重命名