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:

[EMAIL PROTECTED] ~]$ 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

[EMAIL PROTECTED] ~]$ 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to