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

COPY TO Question?

From: "Marc Abbott" <MarcA(at)Medscheme(dot)co(dot)za>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: COPY TO Question?
Date: 2008-08-06 11:59:44
Message-ID: AE9526F06FFC114E9087A83BC2A648BB01E0AC3B@ZARDPEXCH001.medscheme.com (view raw or flat)
Thread:
Lists: pgsql-novice
This email is subject to a disclaimer which may be found by connecting to www.medscheme.co.za and clicking on the "Terms of Use" link.
Alternatively, the disclaimer can be emailed to you by sending a blank email to "meds_disclaimer(at)medscheme(dot)co(dot)za".

---------------------------------------------------------------------------------------------------------------------------------
Hi

 

I am currently running PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled
by GCC gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-47). What I need to
do is COPY FROM a file into a temp table (This I know how to do), then
select and manipulate the data and write it back out to groups of files.
I can insert the manipulated data into another table and then use COPY
TO a file but what I would like to do is open a file with a name and
write pipe delimited lines to it and close it and reopen the next file,
write and so on ..... pretty similar to Oracle's utl_file.fopen,
utl_file.fclose, utl_file.put_line etc. Is this available in postgres?

 

Secondly, is it possible to FTP the same files to a different server?
Would I need to write some form of shell script and execute it? If so
how would I go about doing this from the DB?

 

Your help is appreciated.

 

Regards

Marc

Responses

pgsql-novice by date

Next:From: Daniel GourDate: 2008-08-06 12:16:07
Subject: Re: How to copy a schema under another name in same database
Previous:From: Selvakaruppiah s-TLS,ChennaiDate: 2008-08-05 02:54:00
Subject: SetQueryTimeout in Postgres 8.1.4

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