Re: Viewing Database Scheme - Mailing list pgsql-general

From Tom Lane
Subject Re: Viewing Database Scheme
Date
Msg-id 18808.1138473267@sss.pgh.pa.us
Whole thread Raw
In response to Viewing Database Scheme  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Viewing Database Scheme
List pgsql-general
Rich Shepard <rshepard@appl-ecosys.com> writes:
> When I open the database
> with 'psql contacts' and ask to have the tables dumped (with \d), they go
> streaming by on the display. Of course, the bash 'tee' or 'less' commands
> don't work to allow me to capture the stream to a file or page through the
> output.

Not sure why you say "of course" there.  \d output is properly paginated
for me, and I believe for most people.  What platform are you on, and
what do you have environment variable PAGER set to?  Is the output of
plain old SELECT commands paginated for you?

>    I've looked in the 8.1 pdf manual and the Douglas*2 book without spotting
> the command I need to get a list of all tables and their fields.

There is not a single command; you use queries against the system
catalogs for purposes like this.  The "system catalogs" chapter of
the manual gives the details, but you can get a leg up by looking
at the queries psql uses for whatever form of \d seems closest to
what you want.  Start psql with -E option to make it echo the
queries it's using.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Seeking a better PL/pgSQL editor-debugger
Next
From: Alexander Farber
Date:
Subject: Re: Basic questions about PQprepare()