Re: BUG #15671: The copy command does not load all the lines from a .csv file.

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: ezenchenko(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15671: The copy command does not load all the lines from a .csv file.
Date: 2019-03-06 15:46:48
Message-ID: CAMkU=1z-68inLP+LPb+fc-ZnWDS3_QnH_SBkeusL0OsiUip+-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Mar 6, 2019 at 10:34 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 15671
> Logged by: Эдуард Зенченко
> Email address: ezenchenko(at)gmail(dot)com
> PostgreSQL version: 10.4
> Operating system: Debian 4.9
> Description:
>
> Hello!
> There is a .csv file in windows-1251 encoding.
> The file has 1165988 lines, along with the title.
> I need to upload it to the table.
> I execute the command in PgAdmin 4:
>
> drop table test_csv;
> create table test_csv (addr text, houseid text);
> copy test_csv (addr, houseid) FROM '/tmp/gis_fias_kra.csv' (DELIMITER ';',
> FORMAT CSV, NULL '\', HEADER, ENCODING 'win1251');
>
> In response, I get:
> COPY 993130
> Query returned successfully in 7 secs 352 msec.
>
> In table 993130 records.
> The file is located in a directory on the server.
>
> Why aren't all the lines from the .csv file loaded?

How are you counting the lines in the file? Are any of your newline
characters escaped by being quoted?

select count(*) from test_csv where addr text like E'%\n%' or houseid like
E'%\n%';

Cheers,

Jeff

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Julien Rouhaud 2019-03-06 17:08:30 Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)
Previous Message PG Bug reporting form 2019-03-06 15:06:53 BUG #15672: PostgreSQL 11.1/11.2 crashed after dropping a partition table