Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxG1i-0003mG-N4 for pgsql-general@arkaria.postgresql.org; Tue, 04 Sep 2018 18:26:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fxG1g-0005gZ-H6 for pgsql-general@arkaria.postgresql.org; Tue, 04 Sep 2018 18:26:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxG1g-0005gS-70 for pgsql-general@lists.postgresql.org; Tue, 04 Sep 2018 18:26:08 +0000 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fxG1b-00049C-Uc for pgsql-general@lists.postgresql.org; Tue, 04 Sep 2018 18:26:07 +0000 Received: by mail-oi0-x242.google.com with SMTP id y207-v6so8559951oie.13 for ; Tue, 04 Sep 2018 11:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=BhDXnVFGmpDcluZvTZYpd/fjpLaFRmhQx95IzTOQYeg=; b=py/bHm3uXn6+Ap1WWqWif0RgxwZsY1OYaNJEEvqRhEtp0QtUzWCMfamZWL3CMUslYV UFnuXjsRhvZJuiHWkwzhQ0t6VKfcncCBqY/W8tzmvj6ZSgZJ25nmOBLs3pqwKqRKAf8U 1umCt4hXJI1EXNoJSE9kNzGSI4wdzMmviT3bOWhVPC2UsCWZ0REfVRZsD8YCOSeZw+4f qT/Vssdq8nbUULjG/C9yHkkgKO1iS0c9VDhUtW4G/HK2olgExxX3fTw+nTUQbRwVf0Dl Qc6mAC1XRJaDFHmrHelar0dIBQ3JIF+0M07KVcrrxMYKmCsCJpcR1C/6FZlQppL9CTap sp0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=BhDXnVFGmpDcluZvTZYpd/fjpLaFRmhQx95IzTOQYeg=; b=ujG9O3ZHaT96L6I8Jlyuu572nfISGJ6DV/+cd1GdUFx+Rg1+B015DuXJQfmZMMCGwY fEzUuauzbFjYu+yVx0dn9JY46WkxbiIxqaeXVVXo4S25SSEm9czdfOf9YKDAmyQb42VV 6DoFbG0iuqev3shkMiNcYV4PziWA+UWzWoT9iNqjW5RdrDzIYQoFU1wowrIdRFdB62zd 8+7SB1VpRoo1sjGDqNXHTuWRKasP+oxZQJmg+pRzFu/XXlFEYkStNjPFzZNwgJ7o/zxE bvX+t4a5Fql+jso6+Vqs1aPj4A9xcr+shuwiVNYM9c72UxorBz9R6ZtHamD98HA0SmPJ xuCg== X-Gm-Message-State: APzg51AgfnMd6z+CHfygiFmOhcZGuIvYza1eT2s0CURymXN/nsYNqEzX cQsT96/jaNdx5rpzNCdeniIxxutd X-Google-Smtp-Source: ANB0VdZzET+74j3kvH/qzrOqNMgIHaRJgxdsjYIL4olnCY0KECeqey4dh654zCssYbIp+VGPEmQUVw== X-Received: by 2002:aca:d8d4:: with SMTP id p203-v6mr27341631oig.107.1536085561612; Tue, 04 Sep 2018 11:26:01 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id a8-v6sm14666076oia.24.2018.09.04.11.26.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 11:26:00 -0700 (PDT) Subject: Re: PostgreSQL: Copy from File missing data error To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: Date: Tue, 4 Sep 2018 13:26:00 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------143898F37D37FBFBF229742D" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------143898F37D37FBFBF229742D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit You might want to try pg_bulkload, and have it kick out malformed rows. It's packaged for RHEL6 and above, plus various other distros. On 09/04/2018 01:13 PM, Holly Gibons wrote: > I'm using PostgreSQL 9.0 via pgAdmin III > > I'm trying to build a PostgreSQL/PostGIS database using Entire country > files dataset but I'm > getting missing data error > > I'm wondering if the copy command is affected by diacritics or I've not > set the database up properly > Created a new database with UTF8 encoding > > I built the table schema based on the given format > (but using type > text for NM_MODIFY_DATE not varchar,  having these as dates didn't make a > difference) > > I used large text viewer to open the uncompressed countries.txt file and > copied the top 5 rows into a test file > > Using   PostgreSQL Copy this test file imported correctly so I know my > schema is correct > |copy my_table(List of columns ) from '\\Path\\To\\TestFile.txt' WITH > delimiter E'\t' csv HEADER; | > However when I tried to ingest the larger  countries.txt (2.9GB) file I > get an error "missing data" for column xyz at line 12345 (Last column with >  data in that row, NM_MODIFY_DATE) > > Using large text viewer again I located this line and copied together with > proceeding and following lines into my test file and tried the copy again > but get the same error > > I opened the test file in excel to  see if there is columns  missing > although not every row has data in each column they do  all match > > the problem row has UFI -3373955 & UNI 6329083 > > I don't know if this is relevant but looking at the database properties , > in pgAdmin, the 'collection' &  'Character type' are both set as > "English_United Kingdom, 1252 " I  didn't set this and creating a  new DB > the options are "C",  "English_United Kingdom, 1252 " or "POSIX" > > Could someone suggest what I'm doing wrong? > Thank you -- Angular momentum makes the world go 'round. --------------143898F37D37FBFBF229742D Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit You might want to try pg_bulkload, and have it kick out malformed rows.

It's packaged for RHEL6 and above, plus various other distros.

On 09/04/2018 01:13 PM, Holly Gibons wrote:
I'm using PostgreSQL 9.0 via pgAdmin III

I'm trying to build a PostgreSQL/PostGIS database using Entire country files dataset but I'm getting missing data error

I'm wondering if the copy command is affected by diacritics or I've not set the database up properly
Created a new database with UTF8 encoding

I built the table schema based on the given format (but using type text for NM_MODIFY_DATE not varchar,  having these as dates didn't make a difference)

I used large text viewer to open the uncompressed countries.txt file and copied the top 5 rows into a test file

Using   PostgreSQL Copy this test file imported correctly so I know my schema is correct
copy my_table(List of columns ) from '\\Path\\To\\TestFile.txt' WITH delimiter E'\t' csv HEADER;
However when I tried to ingest the larger  countries.txt (2.9GB) file I get an error "missing data" for column xyz at line 12345 (Last column with  data in that row, NM_MODIFY_DATE)

Using large text viewer again I located this line and copied together with proceeding and following lines into my test file and tried the copy again but get the same error

I opened the test file in excel to  see if there is columns  missing although not every row has data in each column they do  all match
 
the problem row has UFI -3373955 & UNI 6329083 

I don't know if this is relevant but looking at the database properties , in pgAdmin, the 'collection' &  'Character type' are both set as "English_United Kingdom, 1252 " I  didn't set this and creating a  new DB the options are "C",  "English_United Kingdom, 1252 " or "POSIX"

Could someone suggest what I'm doing wrong?
Thank you

--
Angular momentum makes the world go 'round.
--------------143898F37D37FBFBF229742D--