From: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
---|---|
To: | mickael(dot)kerjean(at)gmail(dot)com |
Cc: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14251: COPY CSV: missing data for column that shouldn't be |
Date: | 2016-07-15 09:08:52 |
Message-ID: | CA+bJJbyvCLopNt5cwAYALuzn04ZFZM7NhBE2awX7sHZ0xjetkA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Mickael:
On Fri, Jul 15, 2016 at 4:03 AM, <mickael(dot)kerjean(at)gmail(dot)com> wrote:
> I'm having some bad time inserting data in a csv format coming from:
> https://www.maxmind.com/en/free-world-cities-database
I've downloaded it, it is NOT in CSV format, CSV means more than commas.
I've checked it does not need scaping by doing:
$ perl -ne '@x=split/,/,$_; 7==(at)x or print "$.-$_";'
~/Downloads/worldcitiespop.txt | head
And not getting any output, and checked it does not have backslashes by doing
$ fgrep -c '\' ~/Downloads/worldcitiespop.txt
0
So you could probably load it by NOT using CSV ( as the .txt extension
hints ), that is use FORMAT text ( the default ) and DELIMITER ',' and
it will probably get in fine ( try some variations if not ).
> I tried to import this file using excel and everything was working as
> expected
Excel lies. A lot. Maybe with good intention, but it does many things
behind the scenes, like parsing non-csv data right when told to read
CSV.
Also, CSV is a very ill defined format, I've been unable to use it
properly since the Multiplan days, specially since they started
putting L10N/I18N in it.
Francisco Olarte.
From | Date | Subject | |
---|---|---|---|
Next Message | Thom Brown | 2016-07-15 09:34:08 | Re: Incorrect Spanish error message. |
Previous Message | viswatejelpee | 2016-07-15 07:01:36 | BUG #14252: org.postgresql.util.PSQLException: Too many update results were returned. |