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

Re: can we write to a flat file from Postgresql procedure

From: Henry House <hajhouse(at)houseag(dot)com>
To: R Vijayanath <vijayanath(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: can we write to a flat file from Postgresql procedure
Date: 2001-07-11 02:00:51
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Thu, Jul 05, 2001 at 08:33:04AM -0700, R Vijayanath wrote:
> It would be great if you can tell me if I can write a
> procedure that can write the output to the OS(Linux
> OS) file.

Yes, you can do it :-).

> Can you assist me on this if there is a way to do it.

Try the pg_dump utility, which writes out database to SQL code that may be
used to re-create it on the same or another system. Here is the example
section from the manual page:

       To dump a database:

       $ pg_dump mydb > db.out

       To reload this database:

       $ psql -d database -f db.out

       To dump a database called mydb that contains  BLOBs  to  a
       tar file:

       $ pg_dump -Ft -b mydb > db.tar

       To  reload  this  database  (with  BLOBs)  to  an existing
       database called newdb:

       $ pg_restore -d newdb db.tar

Henry House
OpenPGP key available from

In response to

pgsql-novice by date

Next:From: Baer PeterDate: 2001-07-11 07:26:29
Subject: * Re: Postgres and Linux 7.1
Previous:From: D. DucciniDate: 2001-07-11 00:53:08
Subject: Re: Date/Time insertions in postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group