Re: Writing Text Files from PostgreSQL

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: William Gerber <William(dot)Gerber(at)erg(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Writing Text Files from PostgreSQL
Date: 2005-11-16 19:43:18
Message-ID: c2d9e70e0511161143l5f273339j2022c8d04e5d5642@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 11/16/05, William Gerber <William(dot)Gerber(at)erg(dot)com> wrote:
> Hello. I am brand new to PostgreSQL and I need someone to point me in
> the right direction on how to write the results of a function to a text
> file. Is it possible to do this within the PostgreSQL PL/pgSQL
> language? I have done this before in Oracle using the UTL_FILE commands
> and I was hoping that PostgreSQL had similar functionality. I need to
> provide some data formatting in the text file that I produce so I don't
> think the pg_dump command would work for me (correct me if I am wrong
> though). Thanks in advance for any help that you can give.
>

psql DBname -f script > file
or
psql DBname -c "sql_command;"

psql --help to see options for formatting

>
> System Specs:
> PostgreSQL 8.1 on Linux
>
> --------------------------------------------------------------
> William Gerber
> ERG
> 5608 Parkcrest Drive, Suite 100
> Austin, TX 78731-4947
> ph: 512-407-1827
> fax: 512-419-0089
> e-mail: william(dot)gerber(at)erg(dot)com
> --------------------------------------------------------------
>

--
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2005-11-16 20:06:05 Re: Writing Text Files from PostgreSQL
Previous Message William Gerber 2005-11-16 18:10:40 Writing Text Files from PostgreSQL