pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: expect <expect@ihubbell.com>
To: pgsql-general@postgresql.org
Subject: Re: importing db as text files
Date: Wed, 13 Aug 2003 20:50:06 -0700
Message-ID: <20030813205006.23524be8.expect@ihubbell.com> (raw)
In-Reply-To: <D90A5A6C612A39408103E6ECDD77B8294CE00A@voyager.corporate.connx.com>
References: <D90A5A6C612A39408103E6ECDD77B8294CE00A@voyager.corporate.connx.com>

On Wed, 13 Aug 2003 14:24:30 -0700
"Dann Corbit" <DCorbit@connx.com> wrote:

> > -----Original Message-----
> > From: expect [mailto:expect@ihubbell.com] 
> > Sent: Wednesday, August 13, 2003 2:14 PM
> > To: pgsql-general@postgresql.org
> > Subject: [GENERAL] importing db as text files
> > 
> > What's the big deal with importing text files?  I have a 70 
> > MB file to import and it's been one problem after another.  I 
> > used the copy command and it appears that it's just not 
> > possible. I finally massaged the file into a .sql file and 
> > ran that using \i db.sql but that failed too because I 
> > overlooked ' in names like D'Adario.  The other problem I 
> > encountered was that a numeric field had to have data in it, 
> > pg would not default to the default value.  So instead of 
> > massaging all the data again I decided to change the data 
> > type for that column. This is my first experience with 
> > postgresql and I'm wondering if I should expect to encounter 
> > similar pain as I go further into this?  So far it's been 
> > very painful trying to do what I thought would be easy and 
> > what I think should be easy.  
> 
> I use the copy command all the time without problems.  If the data
> follows the format you describe for copy, there will be no problems.  If
> the data is some other format, then you will have to use perl or sed or
> something to reformat it.


I believe the problem is that pg is unable to use the default value
when a value is not present.

> 
> If your data is in some format that is not easy to massage into
> something that copy wants to eat, then use an ODBC driver for text files
> and move all the data with insert/select.
> 
> Expect no miracles. GI/GO.


Importing a text file is a miracle?  You're scaring me. ;^)

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faqs/FAQ.html
> 
> 



view thread (32+ messages)  latest in thread

Message-ID: <20030813205006.23524be8.expect@ihubbell.com>
Permalink:  ../20030813205006.23524be8.expect@ihubbell.com/
Also on:    postgresql.org/message-id/20030813205006.23524be8.expect@ihubbell.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: expect@ihubbell.com
  Subject: Re: importing db as text files
  In-Reply-To: <20030813205006.23524be8.expect@ihubbell.com>
  References: <D90A5A6C612A39408103E6ECDD77B8294CE00A@voyager.corporate.connx.com> <20030813205006.23524be8.expect@ihubbell.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox