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 23:51:03
Message-ID: Pine.LNX.4.63.0601281542520.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:

> 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(at)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(at)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2006-01-29 00:02:07 Re: Viewing Database Scheme
Previous Message Roderick A. Anderson 2006-01-28 23:24:18 Re: Viewing Database Scheme