PostgreSQL查询系统信息

整理一下,一方面备用,一方面分享

  1. 查询数据表信息

    可通过 information_schema.tables 或 pg_tables

     select tbs.* from pg_tables tbs where tablename  = 'tablename';
    
     select * from information_schema.tables where table_schema='public' and table_name='tablename';
    
  2. 查询表中的字段信息

    通过 from information_schema.columns

     select * from information_schema.columns where table_schema='public' and table_name='tablename';
    

参考链接:hzxPeter nwpu053871

评论

暂无评论