PostgreSQL库表字段信息

数据库

SELECT * FROM pg_database; 

表信息

SELECT schemaname,tablename,tableowner,hasindexes,hasrules,obj_description(relfilenode,'pg_class') AS description FROM pg_tables AS tb INNER JOIN pg_class cs ON cs.relname = tb.tablename WHERE tablename NOT LIKE 'pg%' AND tablename NOT LIKE 'sql_%' ORDER BY tablename; 

字段信息

select table_catalog,table_schema,column_name,ordinal_position,udt_name,character_maximum_length from information_schema.columns where table_schema='public' and table_name='TableName' order by ordinal_position;