Re: Exporting data from PostgreSQL

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: paul(at)entropia(dot)co(dot)uk
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Exporting data from PostgreSQL
Date: 2003-06-13 11:51:18
Message-ID: 58586F66-9D95-11D7-B593-0005029FC1A7@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Friday, Jun 13, 2003, at 16:38 Asia/Tokyo, paul butler wrote:
> Go into psql
>
> mfx=# \pset fieldsep '\t' // sets field delimiter to tab
> Field separator is ' '.
> mfx=# select * from actor; // make your query
> mfx=# \o d:\A\tester.txt // set file to output results
> mfx=# select * from actor; // execute query

Thanks, Paul! That is exactly what I was looking for. I was able to
make a file! :)
Though, for some reason still unknown to me, it wasn't tab-delimited,
even though I entered the commands above and I got back the "Field
separator is ' '." line. It came out the standard pipes and dashes,
though that's easily cleaned up in BBEdit. I'll do a bit more reading
about psql and see if I can't work it out.

One question. Is there a reason why the query is included twice, once
before and once after the \o line? I tried it omitting the first query
and the results seemed just fine.

Thanks again for your help, Paul!

Michael Glaesemann
grzm myrealbox com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Alan Searles 2003-06-13 12:13:54 Re: Converting IBM DB2 TRIGGERs to PostgreSQL
Previous Message Marcus Andree S. Magalhaes 2003-06-13 09:04:56 number of rows