• study PostgreSQL【3-get数据库中all表以及表的字段信息】


    get一表的字段相关信息:

    SELECT  col_description(a.attrelid,a.attnum) as comment,pg_type.typname as typename,a.attname as name, a.attnotnull as notnull
    FROM pg_class as c,pg_attribute as a inner join pg_type on pg_type.oid = a.atttypid
    where c.relname = '表名' and a.attrelid = c.oid and a.attnum>0-----------------------------
    SELECT * 
    FROM pg_class as c,pg_attribute as a inner join pg_type on pg_type.oid = a.atttypid
    where c.relname = '表名' and a.attrelid = c.oid and a.attnum>0

    get表名:

    select * from  pg_tables where schemaname='public'
  • 相关阅读:
    20201107
    20201024
    20201020
    20200331
    20200330
    20200320
    20200319
    20200310
    20200221
    20190926
  • 原文地址:https://www.cnblogs.com/usegear/p/15170004.html
Copyright © 2020-2023  润新知