Skip to content

Commit

Permalink
introspection: use obj_description in table queries for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed Aug 11, 2023
1 parent b9c2750 commit facb547
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ SELECT
(tbl.relhassubclass and tbl.relkind = 'r') as has_subclass,
tbl.relrowsecurity as has_row_level_security,
reloptions,
pd.description as description
obj_description(tbl.oid, 'pg_class') as description
FROM pg_class AS tbl
INNER JOIN pg_namespace AS namespace ON namespace.oid = tbl.relnamespace
LEFT JOIN pg_description pd ON pd.objoid = tbl.oid AND pd.objsubid = 0 AND pd.classoid = 'pg_catalog.pg_class'::regclass::oid
WHERE
( -- (relkind = 'r' and relispartition = 't') matches partition table "duplicates"
(tbl.relkind = 'r' AND tbl.relispartition = 'f')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ SELECT
false as has_subclass,
false as has_row_level_security,
reloptions,
pd.description as description
obj_description(tbl.oid, 'pg_class') as description
FROM pg_class AS tbl
INNER JOIN pg_namespace AS namespace ON namespace.oid = tbl.relnamespace
LEFT JOIN pg_description pd ON pd.objoid = tbl.oid AND pd.objsubid = 0 AND pd.classoid = 'pg_catalog.pg_class'::regclass::oid
WHERE
tbl.relkind = 'r' AND namespace.nspname = ANY ( $1 )
ORDER BY namespace, table_name;

0 comments on commit facb547

Please sign in to comment.