Skip to content

Commit

Permalink
Always use pg_catalog as prefix (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfvanek authored Nov 11, 2024
1 parent 3b0f227 commit 1b092e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions sql/bloated_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ with
sum((1 - coalesce(ps.null_frac, 0)) * coalesce(ps.avg_width, 0)) as null_data_width,
bool_or(pa.atttypid = 'pg_catalog.name'::regtype) or sum(case when pa.attnum > 0 then 1 else 0 end) <> count(ps.attname) as stats_not_available
from
pg_attribute pa
inner join pg_class pc on pc.oid = pa.attrelid
inner join pg_namespace nsp on nsp.oid = pc.relnamespace
left join pg_stats ps on ps.schemaname = nsp.nspname and ps.tablename = pc.relname and ps.inherited = false and ps.attname = pa.attname
left join pg_class toast on toast.oid = pc.reltoastrelid
pg_catalog.pg_attribute pa
inner join pg_catalog.pg_class pc on pc.oid = pa.attrelid
inner join pg_catalog.pg_namespace nsp on nsp.oid = pc.relnamespace
left join pg_catalog.pg_stats ps on ps.schemaname = nsp.nspname and ps.tablename = pc.relname and ps.inherited = false and ps.attname = pa.attname
left join pg_catalog.pg_class toast on toast.oid = pc.reltoastrelid
where
not pa.attisdropped and
pc.relkind = 'r' and
Expand Down
6 changes: 3 additions & 3 deletions sql/sequence_overflow.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ with
else null::bigint
end as last_value
from
pg_sequence s
inner join pg_class c on c.oid = s.seqrelid
left join pg_namespace nsp on nsp.oid = c.relnamespace
pg_catalog.pg_sequence s
inner join pg_catalog.pg_class c on c.oid = s.seqrelid
left join pg_catalog.pg_namespace nsp on nsp.oid = c.relnamespace
where
not pg_is_other_temp_schema(nsp.oid) and -- not temporary
c.relkind = 'S'::char and -- sequence object
Expand Down

0 comments on commit 1b092e0

Please sign in to comment.