bspoel
bspoel

Reputation: 1577

Can psql output a description of all tables, but only tables?

When I do \d public.* I get a list of descriptions of tables, but also of all other indices etc.

When I do \dt public.* I get a list of tablenames, but not the full descriptions of those tables.

Is there a command that gives me the full descriptions of all tables without the other object types?

Version used: psql --version outputs psql (PostgreSQL) 11.5

Upvotes: 0

Views: 44

Answers (1)

user330315
user330315

Reputation:

You can use obj_description() for that:

select tbl.relname as table_name, 
       obj_description(tbl.oid) as comment
from pg_class tbl
  join pg_namespace n on n.oid = tbl.relnamespace
where n.nspname = 'public' 
  and tbl.relkind = 'r' ;

Upvotes: 2

Related Questions