"LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid,\n"+
"pg_type t\n"+
"WHERE c.relname = 'tableName'\n"+
"and a.attnum > 0\n"+
"and a.attrelid = c.oid\n"+
"and a.atttypid = t.oid\n"+
"ORDER BY a.attnum;";
returnsql;
return"select col.column_name AS COLNAME, col.ordinal_position AS COLPOSITION, col.column_default AS DATADEFAULT, col.is_nullable AS NULLABLE, col.udt_name AS DATATYPE, "+
"col.character_maximum_length AS DATALENGTH, col.numeric_precision AS DATAPRECISION, col.numeric_scale AS DATASCALE, des.description AS COLCOMMENT, "+
"case when t.colname is null then 0 else 1 end as COLKEY "+
"from information_schema.columns col left join pg_description des on col.table_name::regclass = des.objoid and col.ordinal_position = des.objsubid "+
"left join ( "+
"select pg_attribute.attname as colname from pg_constraint inner join pg_class on pg_constraint.conrelid = pg_class.oid "+
"inner join pg_attribute on pg_attribute.attrelid = pg_class.oid and pg_attribute.attnum = any(pg_constraint.conkey) "+
"where pg_class.relname = '"+tableName+"' and pg_constraint.contype = 'p' "+
") t on t.colname = col.column_name "+
"where col.table_catalog = '"+dbName+"' and col.table_schema = 'public' and col.table_name = '"+tableName+"' order by col.ordinal_position ";
}
@Override
publicStringtables(StringdbName){
return"SELECT tablename name FROM pg_tables WHERE schemaname = 'public' AND tableowner = '"+dbName+"' ";
return"select relname AS TABLENAME, cast(obj_description(relfilenode, 'pg_class') as varchar) AS TABLECOMMENT from pg_class "+
"where relname in (select tablename from pg_tables where schemaname = 'public' and tableowner = '"+dbName+"' and position('_2' in tablename) = 0) ";