Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Dump and Query



Andy Shellam (Mailing Lists) wrote:
Hi Enrico,

The following command will get you a text file of your result-set:

# echo "SELECT customer_id, first_name, sur_name FROM users;"|/usr/local/pgsql/bin/psql -U [username] -d [database] > myfile.txt
# cat myfile.txt

Alternative version:

psql -d <your dbname> -c "SELECT customer_id, first_name, sur_name FROM users" -o myfile.txt



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group