Created
November 19, 2016 15:03
-
-
Save dexalex84/4dff2796c7a520c2fee4a3f2938e84b4 to your computer and use it in GitHub Desktop.
PostgreSQL Show Indexes and IsUnique Flag in tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
n.nspname TableSchema, | |
c.relname as TableName, | |
a.relname as IndexName, | |
b.indisunique IsUnique | |
from | |
pg_class a | |
inner join | |
pg_index b | |
on | |
a.oid = b.indexrelid | |
inner join | |
pg_class c | |
on | |
b.indrelid = c.oid | |
JOIN | |
pg_catalog.pg_namespace n ON | |
n.oid = a.relnamespace | |
where | |
a.relname not like 'pg_%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment