Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Query to check on indexes with boolean values.
  • Loading branch information
Evreke committed Feb 6, 2024
1 parent 46fbf91 commit de9bc70
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sql/indexes_with_boolean.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
select pi.indrelid::regclass::text as table_name,
pi.indexrelid::regclass::text as index_name,
col.attname as column_name,
col.attnotnull as column_not_null
from
pg_catalog.pg_index pi
join pg_catalog.pg_class pc on pc.oid = pi.indexrelid
join pg_catalog.pg_namespace pn on pn.oid = pc.relnamespace
join pg_catalog.pg_attribute col on col.attrelid = pi.indrelid and col.attnum = any (pi.indkey)
where pn.nspname = 'public'::text
and not pi.indisunique
and pi.indisready
and pi.indisvalid
and col.atttypid = 'boolean'::regtype
order by table_name, index_name;

0 comments on commit de9bc70

Please sign in to comment.