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 997DED1B4E9 for ; Thu, 25 Sep 2003 18:13:24 +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 42836-04 for ; Thu, 25 Sep 2003 15:12:52 -0300 (ADT) Received: from lakemtai07.cox.net (lakemtai07.cox.net [68.1.17.125]) by svr1.postgresql.org (Postfix) with ESMTP id B63A2D1B546 for ; Thu, 25 Sep 2003 15:12:50 -0300 (ADT) Received: from lhosts ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20030925165758.LZTD29208.lakemtao01.cox.net@lhosts> for ; Thu, 25 Sep 2003 12:57:58 -0400 Subject: Re: populate table with large csv file From: Ron Johnson To: PgSQL General ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1064509077.1441.57.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Thu, 25 Sep 2003 11:57:57 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/1639 X-Sequence-Number: 49858 On Thu, 2003-09-25 at 11:38, Dave [Hawk-Systems] wrote: > have the table "numbercheck" > Attribute | Type | Modifier > -----------+------------+---------- > svcnumber | integer | not null > svcqual | varchar(9) | > svcequip | char(1) | > svctroub | varchar(6) | > svcrate | varchar(4) | > svcclass | char(1) | > trailer | varchar(3) | > Index: numbercheck_pkey > > also have a csv file > 7057211380,Y,,,3,B > 7057216800,Y,,,3,B > 7057265038,Y,,,3,B > 7057370261,Y,,,3,B > 7057374613,Y,,,3,B > 7057371832,Y,,,3,B > 4166336554,Y,,,3,B > 4166336863,Y,,,3,B > 7057201148,Y,,,3,B > > aside from parsing the csv file through a PHP interface, what isthe easiest way > to get that csv data importted into the postgres database. thoughts? No matter what you do, it's going to barf: svcnumber is a 32-bit integer, and 7,057,211,380 is significantly out of range. Once you change svcnumber to bigint, the COPY command will easily suck in the csv file. -- ----------------------------------------------------------------- Ron Johnson, Jr. ron.l.johnson@cox.net Jefferson, LA USA "Python is executable pseudocode; Perl is executable line noise"