经典语句

查询表的字段名,类型,注释语句

SELECT col.table_schema,col.table_name,col.column_name,col.data_type ,
col.character_maximum_length,col.numeric_precision,col.numeric_scale,
col.is_nullable,col.column_default,des.description
 FROM information_schema.columns col LEFT JOIN sr_description des
	ON (col.table_schema||'.'||col.table_name)::regclass = des.objoid
	    AND col.ordinal_position = des.objsubid
	        WHERE col.table_name = 'test2' and col.table_schema='test'
		ORDER BY ordinal_position;



你可能感兴趣的:(经典语句)