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

Re: script

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Novice ML <pgsql-novice(at)postgresql(dot)org>
Subject: Re: script
Date: 2002-05-24 13:02:03
Message-ID: 1022245323.631.17.camel@rebel (view raw or flat)
Thread:
Lists: pgsql-novice
On Fri, 2002-05-24 at 03:21, Annissa Melhenas wrote:
> 		Hi all,
> I'm new to postgreSQL,a dn I'd like to write a script that will insert all 
> my entries (I have almost 800 000 entries)in a pgsql database.so, the 
> question is : which script language can I use, and how do I use it (ie, 
> how do I run it?)
> Thanks for your replies,

Look in the Novice Archives from earlier this week, for a
thread regarding the _exact_ same topic.

Question: what do your records look like?  Is each field 
delimited, or are they fixed-length?  If they are delimited
(by tab, comma, etc.) and there are no double-quotes around
each field (or you can safely get rid of them with tr), then 
the COPY will probably work great.

If you can't use COPY, then you must write a small program
(in the language of your choice) to massage the data before
INSERTing it.  I use python, others perl and C.

-- 
+---------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron(dot)l(dot)johnson(at)cox(dot)net     |
| Jefferson, LA  USA      http://ronandheather.dhs.org:81 |
|                                                         |
| "I have created a government of whirled peas..."        |
|   Maharishi Mahesh Yogi, 12-May-2002,                   |
!   CNN, Larry King Live                                  |
+---------------------------------------------------------+


In response to

  • script at 2002-05-24 08:21:32 from Annissa Melhenas

pgsql-novice by date

Next:From: Ron JohnsonDate: 2002-05-24 13:14:40
Subject: Why sequential scan when there's a supporting index?
Previous:From: Ron JohnsonDate: 2002-05-24 12:48:56
Subject: Re: discovering an index definition

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