Re: Viewing Database Scheme - Mailing list pgsql-general

From Eric B. Ridge
Subject Re: Viewing Database Scheme
Date
Msg-id 726883B0-CB99-49B7-8B66-4ADDFC9DEA28@tcdi.com
Whole thread Raw
In response to Re: Viewing Database Scheme  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
On Jan 28, 2006, at 3:20 PM, Rich Shepard wrote:
> contacts=# \d | less
> \d: extra argument "less" ignored

You can't do this via the psql prompt.  A simple "\d" will output to
the screen, automatically using your $PAGER if the output is too long
to fit on your screen.

>   I can, however, run '\dt' and have it page normally. But, I
> cannot write
> that output to a file using redirection or the tee command:
>
> contacts=# \dt > xrms.tables
> No matching relations found.
> \dt: extra argument "xrms.tables" ignored

Again, you can't use redirection via the psql prompt.  But you can do
it via your shell command line:

$ psql -c "\dt" > xrms.tables

Alternatively, you can use psql's "\o [FILE]" command to redirect
query results to a file:

contacts=# \o /tmp/xrms.tables
contacts=# \dt
contacts=#

That'll send all output to /tmp/xrms.tables.

>   I'll be sure to read that section. The \dt and \di commands show
> me what I
> want, but I cannot redirect output to a file. What am I still missing,
> please?

You should also read the psql man page and the output of psql's "\h"
command.

eric

pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Viewing Database Scheme
Next
From: Philippe Ferreira
Date:
Subject: Re: My very first PL/pgSQL procedure...