select relname as TABLE_NAME ,col_description(c.oid,0)as COMMENTS from pg_class c
where relkind ='r'and relname notlike'pg_%'and relname notlike'sql_%'orderby relname
select'true'as list,'true'as edit,'false'as search,
a.attname as column_name,
format_type(a.atttypid,a.atttypmod)as data_type,(casewhen atttypmod-4>0then atttypmod-4else0end)data_length,(casewhen(selectcount(*)from pg_constraint where conrelid = a.attrelid and conkey[1]=attnum and contype='p')>0then'Y'else'N'end)as P,(casewhen(selectcount(*)from pg_constraint where conrelid = a.attrelid and conkey[1]=attnum and contype='u')>0then'Y'else'N'end)as U,(casewhen(selectcount(*)from pg_constraint where conrelid = a.attrelid and conkey[1]=attnum and contype='f')>0then'Y'else'N'end)as R,(casewhen a.attnotnull=truethen'Y'else'N'end)as nullable,
col_description(a.attrelid,a.attnum)ascomment,'XEditText'as control
from pg_attribute a
where attstattarget=-1and attrelid =(select oid from pg_class where relname ='userinfo')