Re: Creating Text Files from Tables

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Warren Murray <murray_warren(at)bah(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Creating Text Files from Tables
Date: 2006-02-10 15:06:58
Message-ID: 3FAFD21B-FBD8-4DE5-BB8B-9B05DAE48BC5@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Feb 10, 2006, at 8:06 AM, Warren Murray wrote:

> This maybe be on a more complex side, but I'm a novice to say the
> least, how
> can I export a text delimited file from Postgresql. The file will be
> transferred into a specific directory for use with another system.
> text
> file row sample: 396,"bigshoes.blue.7"

The COPY command can produce CSV files (as well as files with other
delimiters):

http://www.postgresql.org/docs/8.1/interactive/sql-copy.html

>
> My last question is how can I create a series of fixed-width text
> files from
> tables and/or queries in a Postgresql database?

You could write some pl/pgsql functions to write the data to a temp
table and then COPY it.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2006-02-11 06:58:17 Re: Creating Text Files from Tables
Previous Message A. Kretschmer 2006-02-10 14:17:31 Re: Creating Text Files from Tables