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

populating postgresql from tab-delimited text file

From: ksprague(at)NRCan(dot)gc(dot)ca
To: pgsql-novice(at)postgresql(dot)org
Subject: populating postgresql from tab-delimited text file
Date: 2001-09-17 19:33:31
Message-ID: 3BA6500B.87BFE452@NRCan.gc.ca (view raw or flat)
Thread:
Lists: pgsql-novice
Hi,

What is quickest and dirtiest way to load the contents of a
tab-delimited text file into a postgresql database?

I would like to do this with a batch file that expects certain specified
fields from the data text file (fields may belong to different tables). 
Speed is also an issue -- I fear that repeated INSERT commands may be
too slow.

I thought of writing an sql statement file and then using the -f option,
but I would rather skip having to create an intermediate file and do the
insertions directly.

Has anyone done this? Any example shell code...using COPY command
perhaps? :>

Regards,
Kevin

pgsql-novice by date

Next:From: Vijay DevalDate: 2001-09-18 03:27:14
Subject: Re: Out of memory error
Previous:From: Tom LaneDate: 2001-09-17 14:45:20
Subject: Re: Out of memory error

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