Re: Viewing Database Scheme

From: "Eric B(dot) Ridge" <ebr(at)tcdi(dot)com>
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 20:51:20
Message-ID: 726883B0-CB99-49B7-8B66-4ADDFC9DEA28@tcdi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philippe Ferreira 2006-01-28 21:04:36 Re: My very first PL/pgSQL procedure...
Previous Message Rich Shepard 2006-01-28 20:26:26 Re: Viewing Database Scheme