Re: Viewing Database Scheme

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Viewing Database Scheme
Дата
Msg-id Pine.LNX.4.63.0601281313290.14888@salmo.appl-ecosys.com
обсуждение исходный текст
Ответ на Viewing Database Scheme  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Viewing Database Scheme  (Doug McNaught <doug@mcnaught.org>)
Список 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@salmo ~]$ psql -c contacts "\dt" > xrms.tables
psql: FATAL:  database "\dt" does not exist

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

[rshepard@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@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

В списке pgsql-general по дате отправления:

Предыдущее
От: Philippe Ferreira
Дата:
Сообщение: Re: My very first PL/pgSQL procedure...
Следующее
От: "Eric B. Ridge"
Дата:
Сообщение: Re: Viewing Database Scheme