pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
problems with copy
2+ messages / 2 participants
[nested] [flat]

* problems with copy
@ 2007-09-25 00:38  chester c young <chestercyoung@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: chester c young @ 2007-09-25 00:38 UTC (permalink / raw)
  To: pgsql-sql

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?



      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: problems with copy
@ 2007-09-28 16:21  Luis Carlos Ferreira <lcf@tuxedo.com.ar>
  parent: chester c young <chestercyoung@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Luis Carlos Ferreira @ 2007-09-28 16:21 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-09-28 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-25 00:38 problems with copy chester c young <chestercyoung@yahoo.com>
2007-09-28 16:21 ` Luis Carlos Ferreira <lcf@tuxedo.com.ar>

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