Re: BUG #14251: COPY CSV: missing data for column that shouldn't be

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: BUG #14251: COPY CSV: missing data for column that shouldn't be
Дата
Msg-id CA+bJJbyvCLopNt5cwAYALuzn04ZFZM7NhBE2awX7sHZ0xjetkA@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #14251: COPY CSV: missing data for column that shouldn't be  (mickael.kerjean@gmail.com)
Список pgsql-bugs
Mickael:

On Fri, Jul 15, 2016 at 4:03 AM,  <mickael.kerjean@gmail.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==@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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: BUG #14245: Segfault on weird to_tsquery
Следующее
От: Thom Brown
Дата:
Сообщение: Re: Incorrect Spanish error message.