Re: Viewing Database Scheme

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Viewing Database Scheme
Date: 2006-01-28 18:34:27
Message-ID: 18808.1138473267@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Rich Shepard <rshepard(at)appl-ecosys(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2006-01-28 19:26:01 Re: Basic questions about PQprepare()
Previous Message Tom Lane 2006-01-28 18:26:04 Re: Seeking a better PL/pgSQL editor-debugger