Skip to content

Commit

Permalink
[TABLES_WITHOUT_DESCRIPTION] Consider to skip partitions of table (#64)
Browse files Browse the repository at this point in the history
* Skip partitions

* Skip partitions
  • Loading branch information
mfvanek authored Dec 10, 2024
1 parent 1ff7b1c commit 6623916
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions sql/columns_without_description.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
-- Finds columns that don't have a description.
-- See also https://www.postgresql.org/docs/current/sql-comment.html
select
t.oid::regclass::text as table_name,
pc.oid::regclass::text as table_name,
col.attname::text as column_name,
col.attnotnull as column_not_null
from
pg_catalog.pg_class t
inner join pg_catalog.pg_namespace nsp on nsp.oid = t.relnamespace
inner join pg_catalog.pg_attribute col on col.attrelid = t.oid
pg_catalog.pg_class pc
inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace
inner join pg_catalog.pg_attribute col on col.attrelid = pc.oid
where
t.relkind = 'r' and
pc.relkind in ('r', 'p') and
not pc.relispartition and
col.attnum > 0 and /* to filter out system columns such as oid, ctid, xmin, xmax, etc. */
not col.attisdropped and
(col_description(t.oid, col.attnum) is null or length(trim(col_description(t.oid, col.attnum))) = 0) and
(col_description(pc.oid, col.attnum) is null or length(trim(col_description(pc.oid, col.attnum))) = 0) and
nsp.nspname = :schema_name_param::text
order by table_name, column_name;
3 changes: 2 additions & 1 deletion sql/tables_without_description.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
not pc.relispartition and
(obj_description(pc.oid) is null or length(trim(obj_description(pc.oid))) = 0) and
nsp.nspname = :schema_name_param::text
order by table_name;

0 comments on commit 6623916

Please sign in to comment.