Re: Viewing Database Scheme - Mailing list pgsql-general

From Rich Shepard
Subject Re: Viewing Database Scheme
Date
Msg-id Pine.LNX.4.63.0601281542520.14888@salmo.appl-ecosys.com
Whole thread Raw
In response to Re: Viewing Database Scheme  ("Eric B. Ridge" <ebr@tcdi.com>)
List pgsql-general
On Sat, 28 Jan 2006, Eric B. Ridge wrote:

> That's because you've used the wrong syntax.
>
> $ psql contacts -c "\dt" > xrms.tables
>
> This is why I suggested you read the psql man page.

   Well, the man page installed shows the -c option is to specify one command,
but when I try that:

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

   That's why I tried specifying the database name.

> Likely, the output is buffered.  Did you try quitting psql (via \q) before
> checking the contents of the file.

   Yes.

> Dude, "pg_dump" is not a psql command, nor is it a SQL command.  It's a
> command-line program.  You run it from your shell:
>
> $ pg_dump --schema-only pg_dump > xrms-schema.dmp

[rshepard@salmo ~]$ pg_dump --schema-only pg_dump > xrms-schema.dmp
pg_dump: [archiver (db)] connection to database "pg_dump" failed: FATAL:
database "pg_dump" does not exist

   However, as the pg_dump man page specifies, the database name needs to be
listed on the coammand line. So,

$ pg_dump -s contacts > xrms.tables

works just fine.

   I'm still curious why I cannot do this within psql.

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 by date:

Previous
From: "Roderick A. Anderson"
Date:
Subject: Re: Viewing Database Scheme
Next
From: Rich Shepard
Date:
Subject: Re: Viewing Database Scheme