Skip to content

Commit

Permalink
[TABLES_NOT_LINKED_TO_OTHERS] Decide how to handle partitioned tables (
Browse files Browse the repository at this point in the history
  • Loading branch information
mfvanek authored Dec 10, 2024
1 parent 6623916 commit e9b0afe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions sql/tables_not_linked_to_others.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ from
inner join nsp on nsp.oid = pc.relnamespace
where
pc.relkind in ('r', 'p') and
not pc.relispartition and
pc.oid not in (select * from fkeys)
order by table_name;
3 changes: 2 additions & 1 deletion sql/tables_without_primary_key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ from
pg_catalog.pg_class pc
inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace
where
pc.relkind = 'r' and
pc.relkind in ('r', 'p') and
/* here we do not filter by pc.relispartition, because very often primary keys are created only for partitions */
pc.oid not in (
select c.conrelid as table_oid
from pg_catalog.pg_constraint c
Expand Down

0 comments on commit e9b0afe

Please sign in to comment.