diff --git a/sql/tables_not_linked_to_others.sql b/sql/tables_not_linked_to_others.sql index dc9890d..e265b3d 100644 --- a/sql/tables_not_linked_to_others.sql +++ b/sql/tables_not_linked_to_others.sql @@ -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; diff --git a/sql/tables_without_primary_key.sql b/sql/tables_without_primary_key.sql index b948f91..c52e76d 100644 --- a/sql/tables_without_primary_key.sql +++ b/sql/tables_without_primary_key.sql @@ -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