PostgreSql获取所有的表、视图、字段、主键壮阳运动>advance
1、PostgreSQL获取数据库中所有view名 视图:
SELECT viewname FROM pg_views
WHERE schemaname ='public'
2、postgreSQL获取数据库中所有table名 表:
SELECT tablename FROM pg_tables
吉安旅游景点推荐WHERE tablename NOT LIKE 'pg%'
AND tablename NOT LIKE 'sql_%'
海贼王壁纸高清ORDER BY tablename;
3、postgreSQL获取某个表tablename 所有字段名称 , 类型,备注,是否为空 等
什么是足金SELECT col_description(a.attrelid,a.attnum) as comment,pname 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
lname = 'tablename' and a.attrelid = c.oid and a.attnum>0
预防为主4、postgreSQL获取某个表tablename 的主键信息
lect pg_attribute.attname as colname,pname as typename,ame as pk_name from
pg_constraint inner join pg_class on lid = pg_class.oid inner join pg_attribute on pg_attribute.attrelid = pg_class.oid and pg_attribute.attnum = key[1] inner join pg_type on pg_type.oid = pg_attribute.atttypid where lname = 'tablename' and pe='p'