sudo -u postgres psql -E
postgres=# \dt********* QUERY **********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' END as "Type",pg_catalog.pg_get_userbyid(c.relowner) as "Owner"FROM pg_catalog.pg_class cLEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespaceWHERE 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;**************************
SELECT c.relname AS Tables_in FROM pg_catalog.pg_class cLEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespaceWHERE pg_catalog.pg_table_is_visible(c.oid)AND c.relkind = 'r'AND relname NOT LIKE 'pg_%'ORDER BY 1
# just list all the postgres tables sorted in the terminaldb='my_db_name'clear;psql -d $db -t -c '\dt'|cut -c 11-|perl -ne 's/^([a-z_0-9]*)( )(.*)/$1/; print'