back

by rietta·10y ago·view on hn ↗
Nice!

Maybe I am missing something, but I am not seeing a way to dig into a given database's structure without cumbersomely querying the pg_catalog. Noticeably absent are \dt and such vs running stuff like

SELECT n.nspname as "Schema", c.relname as "Name", CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 'f' THEN 'foreign table' END as "Type", pg_catalog.pg_get_userbyid(c.relowner) as "Owner" FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','') AND n.nspname <> 'pg_catalog' AND n.nspname <> 'information_schema' AND n.nspname !~ '^pg_toast' AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 1,2;

Database Info from the menu seems to be similar to \d and a few others, but it's for the whole database and not a specific schema.

Still, I will keep playing with this and see how it goes.

1 comments
It is possible to get info about specific object just by typing its name and pressing "Object Info" shortcut. To list the schema's objects you need to type "schema_name." (with dot in the end) and press "Object Info" shortcut.