Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 9CE6B9FB3F4 for ; Fri, 28 Sep 2007 13:27:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 05033-06 for ; Fri, 28 Sep 2007 13:27:45 -0300 (ADT) X-Greylist: delayed 00:06:35.618795 by SQLgrey-1.7.5 Received: from camel.luzyfuerza.org.ar (unknown [200.0.209.228]) by postgresql.org (Postfix) with SMTP id D9E029FB356 for ; Fri, 28 Sep 2007 13:27:45 -0300 (ADT) Received: (qmail 16304 invoked from network); 28 Sep 2007 16:21:03 -0000 Received: from lcf.luzyfuerza.org (HELO lcf.luzyfuerza.org.ar) (10.7.17.3) by fw.in-addr.arpa with SMTP; 28 Sep 2007 16:21:03 -0000 From: Luis Carlos Ferreira To: pgsql-sql@postgresql.org Subject: Re: problems with copy Date: Fri, 28 Sep 2007 13:21:37 -0300 User-Agent: KMail/1.8.2 References: <660727.9191.qm@web54304.mail.re2.yahoo.com> In-Reply-To: <660727.9191.qm@web54304.mail.re2.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200709281321.38410.lcf@tuxedo.com.ar> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.101 tagged_above=0 required=5 tests=BAYES_50=0.001, RDNS_NONE=0.1 X-Spam-Level: X-Archive-Number: 200709/159 X-Sequence-Number: 29372 El Lun 24 Sep 2007 21:38, chester c young escribi=F3: > I'm getting lots of delimited files from Excel and MySQL users that, > mid-file, begin truncating lines if ending in null values. >=20 > for example: > 1781: "one","two","three",,,,,, > 1782: "one","two","three",, > 1783: "one","two","three",, >=20 > (delimited files from Open Office are well behaved) >=20 > is there any way to handle this apparently standard aberration in PG? > You need to normalize the csv files filtering its contents with some script =2E.. =2E.. $fields_in_table=3D9; while (<>) { chomp; @f=3Dsplit(","); for $i ( 0 .. $fields_in_table ) { print $f[$i].","; }; print "\n"; }; =2E.. =2E.. =2D-=20 Luis