Skip to content

Commit

Permalink
Wrong detection of Duplicated indexes with different collation (#7)
Browse files Browse the repository at this point in the history
mfvanek/pg-index-health#76

Co-authored-by: ivan.vakhrushev <ivvakhrushev@yandex-team.ru>
  • Loading branch information
mfvanek and ivan.vakhrushev committed Apr 25, 2020
1 parent a697c71 commit 7b36582
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sql/duplicated_indexes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ from (
select x.indexrelid::regclass as idx,
x.indrelid::regclass as table_name,
(x.indrelid::text || ' ' || x.indclass::text || ' ' || x.indkey::text || ' ' ||
coalesce(pg_get_expr(x.indexprs, x.indrelid), '') || e' ' ||
x.indcollation::text || e' ' ||
coalesce(pg_get_expr(x.indexprs, x.indrelid), '') || ' ' ||
coalesce(pg_get_expr(x.indpred, x.indrelid), '')) as key
from pg_catalog.pg_index x
join pg_catalog.pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid
join pg_catalog.pg_stat_all_indexes psai on x.indexrelid = psai.indexrelid
where psai.schemaname = :schema_name_param::text
) sub
group by table_name, key
Expand Down

0 comments on commit 7b36582

Please sign in to comment.