Re: Viewing Database Scheme

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Viewing Database Scheme
Date: 2006-01-28 21:13:54
Message-ID: Pine.LNX.4.63.0601281313290.14888@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 28 Jan 2006, Eric B. Ridge wrote:

> 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.

Eric,

That's what I assumed; perhaps I misunderstood Tom Lane's "what do you mean
'ofcourse'?".

> 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

Well, that doesn't seem to be working here, either:

[rshepard(at)salmo ~]$ psql -c contacts "\dt" > xrms.tables
psql: FATAL: database "\dt" does not exist

[rshepard(at)salmo ~]$ psql "-c contacts \dt" > xrms.tables
psql: FATAL: database "rshepard" does not exist

[rshepard(at)salmo ~]$ psql -c contacts
psql: FATAL: database "rshepard" does not exist

> 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.

This creates the file, but it's empty.

I'm curious what's gone wrong here. Nothing seems to be working as it
should.

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

I've done both and tried various combinations of syntax. For example:

[rshepard(at)salmo ~]$ psql -d contacts -c pg_dump -o xrms.tables
ERROR: syntax error at or near "pg_dump" at character 1
LINE 1: pg_dump

All I get are error messages.

Thanks,

Rich

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Responses

Browse pgsql-general by date

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