SELECT UPPER(t.relname) as table_name UPPER(a.attname) as column_name FROM pg_class t, pg_class i, pg_index ix, pg_attribute a, pg_namespace WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND ( a.attnum = ix.indkey[0] OR a.attnum = ix.indkey[1] OR a.attnum = ix.indkey[2] OR a.attnum = ix.indkey[3] OR a.attnum = ix.indkey[5] OR a.attnum = ix.indkey[6] OR a.attnum = ix.indkey[7] OR a.attnum = ix.indkey[8] OR a.attnum = ix.indkey[9] OR a.attnum = ix.indkey[10] OR a.attnum = ix.indkey[11] OR a.attnum = ix.indkey[12] OR a.attnum = ix.indkey[13] OR a.attnum = ix.indkey[14] ) AND t.relkind = 'r' AND t.relnamespace = pg_namespace.oid AND pg_namespace.nspname = 'public' ORDER BY t.relname, a.attname;
Oracle:
SELECT table_name, column_name FROM user_ind_columns ORDER BY table_name, column_name
No hay comentarios:
Publicar un comentario