patternsqlMinor
Only describing postgres tables with "\d" (not sequences, indexes, views, ...)
Viewed 0 times
tablespostgreswithindexesdescribingviewssequencesnotonly
Problem
I want to describe every table in a postgres database.
Currently I have this:
But this also includes all sequences, views, etc.
Is there a command where the
Or is there another way to do this?
Currently I have this:
psql -d db -c "\d *" > db_description.txtBut this also includes all sequences, views, etc.
Is there a command where the
* pattern only matches tables?Or is there another way to do this?
Solution
How about simply using the
If you want to know what those commands do behind the scenes, you could also start psql with the -E option, as asked here. You could therefore rewrite this query to get exactly what you want, be it views, sequences, tables... or any combination of the above.
\dt command? It's here to list tables only. You can get more help on PostgreSQL inner commands by issuing the \? command.If you want to know what those commands do behind the scenes, you could also start psql with the -E option, as asked here. You could therefore rewrite this query to get exactly what you want, be it views, sequences, tables... or any combination of the above.
Context
StackExchange Database Administrators Q#136046, answer score: 8
Revisions (0)
No revisions yet.