pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Luis Carlos Ferreira <lcf@tuxedo.com.ar>
To: pgsql-sql@postgresql.org
Subject: Re: problems with copy
Date: Fri, 28 Sep 2007 13:21:37 -0300
Message-ID: <200709281321.38410.lcf@tuxedo.com.ar> (raw)
In-Reply-To: <660727.9191.qm@web54304.mail.re2.yahoo.com>
References: <660727.9191.qm@web54304.mail.re2.yahoo.com>

El Lun 24 Sep 2007 21:38, chester c young escribió:
> I'm getting lots of delimited files from Excel and MySQL users that,
> mid-file, begin truncating lines if ending in null values.
> 
> for example:
> 1781: "one","two","three",,,,,,
> 1782: "one","two","three",,
> 1783: "one","two","three",,
> 
> (delimited files from Open Office are well behaved)
> 
> 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
...
...
$fields_in_table=9;
while (<>) {
 chomp;
 @f=split(",");
 for $i ( 0 .. $fields_in_table ) {
    print $f[$i].",";
 };
 print "\n";
};
...
...

-- 

Luis



view thread (2+ messages)

Message-ID: <200709281321.38410.lcf@tuxedo.com.ar>
Permalink:  ../200709281321.38410.lcf@tuxedo.com.ar/
Also on:    postgresql.org/message-id/200709281321.38410.lcf@tuxedo.com.ar

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lcf@tuxedo.com.ar
  Subject: Re: problems with copy
  In-Reply-To: <200709281321.38410.lcf@tuxedo.com.ar>

* 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