"select a.ORDINAL_POSITION, a.COLUMN_NAME, a.DATA_TYPE, a.COLUMN_COMMENT, a.COLUMN_KEY, a.EXTRA from information_schema.`COLUMNS` a where a.TABLE_SCHEMA=? and a.TABLE_NAME = ? order by a.ORDINAL_POSITION"
"select TABLE_NAME, TABLE_TYPE, TABLE_COMMENT from information_schema.`TABLES` a where a.TABLE_SCHEMA = ?"
"SELECT\n\tordinal_position AS ORDINAL_POSITION,\n\tCOLUMN_NAME AS COLUMN_NAME,\n\tdata_type AS DATA_TYPE1,\n\tudt_name as DATA_TYPE,\n\tCOALESCE ( character_maximum_length, numeric_precision,- 1 ) AS LENGTH,\n\tnumeric_scale AS SCALE,\nCASE\n\t\tis_nullable \n\t\tWHEN \'NO\' THEN\n\t\t0 ELSE 1 \n\tEND AS CanNull,\n\tcolumn_default AS EXTRA,\nCASE\n\t\t\n\t\tWHEN POSITION ( \'nextval\' IN column_default ) > 0 THEN\n\t\t1 ELSE 0 \n\tEND AS IsIdentity,\nCASE\n\t\t\n\t\tWHEN b.pk_name IS NULL THEN\n\t\t\'\' ELSE \'PRI\' \n\tEND AS COLUMN_KEY,\n\tC.DeText as COLUMN_COMMENT \nFROM\n\tinformation_schema.\n\tCOLUMNS LEFT JOIN (\n\tSELECT\n\t\tpg_attr.attname AS colname,\n\t\tpg_constraint.conname AS pk_name \n\tFROM\n\t\tpg_constraint\n\t\tINNER JOIN pg_class ON pg_constraint.conrelid = pg_class.oid\n\t\tINNER JOIN pg_attribute pg_attr ON pg_attr.attrelid = pg_class.oid \n\t\tAND pg_attr.attnum = pg_constraint.conkey [ 1 ]\n\t\tINNER JOIN pg_type ON pg_type.oid = pg_attr.atttypid \n\tWHERE\n\t\tpg_class.relname = ? \n\t\tAND pg_constraint.contype = \'p\' \n\t) b ON b.colname = information_schema.COLUMNS.\n\tCOLUMN_NAME LEFT JOIN (\n\tSELECT\n\t\tattname,\n\t\tdescription AS DeText \n\tFROM\n\t\tpg_class\n\t\tLEFT JOIN pg_attribute pg_attr ON pg_attr.attrelid = pg_class.oid\n\t\tLEFT JOIN pg_description pg_desc ON pg_desc.objoid = pg_attr.attrelid \n\t\tAND pg_desc.objsubid = pg_attr.attnum \n\tWHERE\n\t\tpg_attr.attnum > 0 \n\t\tAND pg_attr.attrelid = pg_class.oid \n\t\tAND pg_class.relname = ? \n\t) C ON C.attname = information_schema.COLUMNS.COLUMN_NAME \nWHERE\n\ttable_schema = ? \n\tand table_name = ? \nORDER BY\n\tordinal_position ASC"
"select a.relname as TABLE_NAME, b.description as TABLE_COMMENT from pg_class a left join ( select * from pg_description where objsubid = 0 ) b on A.oid = b.objoid where a.relname in ( select tablename from pg_tables where schemaname = ? ) order by a.relname asc"