X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 09CDBD1C9D4 for ; Thu, 14 Aug 2003 03:51:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50354-06 for ; Thu, 14 Aug 2003 00:49:38 -0300 (ADT) Received: from ohio.stageserver.net (ohio.stageserver.net [216.180.225.74]) by svr1.postgresql.org (Postfix) with ESMTP id 4C56FD1C93C for ; Thu, 14 Aug 2003 00:50:06 -0300 (ADT) Received: from ip68-6-45-108.sb.sd.cox.net ([68.6.45.108] helo=localhost.localdomain) by ohio.stageserver.net with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.20) id 19n97p-0007f7-JS for pgsql-general@postgresql.org; Wed, 13 Aug 2003 22:50:09 -0500 Date: Wed, 13 Aug 2003 20:50:06 -0700 From: expect To: Subject: Re: importing db as text files Message-Id: <20030813205006.23524be8.expect@ihubbell.com> In-Reply-To: References: Organization: iHubbell X-Mailer: Sylpheed version 0.9.4claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ohio.stageserver.net X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - ihubbell.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/665 X-Sequence-Number: 47082 On Wed, 13 Aug 2003 14:24:30 -0700 "Dann Corbit" 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 > >