Import from CSV error

From: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Import from CSV error
Date: 2013-10-28 11:58:11
Message-ID: CAMu32ABXgg-x-ujvXumvuYmFLm0Vp81TMNfyjm+XC0dZJgMHzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

Does anyone know why this doesn't work please?

DROP TABLE temp;
CREATE TABLE temp(id integer);
SELECT AddGeometryColumn('temp', 'the_geom', 4326, 'LINESTRING', 2);
COPY temp FROM 'C:/Program Files/PostgreSQL/9.2/data/tube_o_r.txt'
DELIMITER ';';

ERROR: parse error - invalid geometry
HINT: "ST" <-- parse error at position 2 within geometry
CONTEXT: COPY temp, line 1, column the_geom:
"ST_GeomFromText('LINESTRING(-0.11453 51.50366,-0.11450
51.50369,-0.11422 51.50404,-0.11392 51.50397,..."

My file is a txt file, with no headers, with the two columns separated
by a semi-colon. Line one of the file is shown below:

1;ST_GeomFromText('LINESTRING(-0.11453 51.50366,-0.11450
51.50369,-0.11422 51.50404,-0.11392 51.50397,-0.11367
51.50392,-0.11327 51.50384,-0.11329 51.50381,-0.11329
51.50381,-0.11512 51.50310,-0.11497 51.50312,-0.11500
51.50321,-0.11513 51.50350,-0.11555 51.50383,-0.11602
51.50405,-0.11814 51.50467,-0.11880 51.50497,-0.12130
51.50631,-0.12184 51.50647,-0.12285 51.50668,-0.12285
51.50668,-0.12487 51.50710,-0.12590 51.50724,-0.12807
51.50743,-0.12807 51.50743,-0.12965 51.50757,-0.13080
51.50769,-0.13104 51.50776,-0.13125 51.50788,-0.13176
51.50851,-0.13203 51.50884,-0.13306 51.50983,-0.13346
51.50997,-0.13392 51.51001,-0.13527 51.50996,-0.13527
51.50996,-0.13631 51.50992,-0.13696 51.50991,-0.13735
51.50997,-0.13769 51.51007,-0.13800 51.51023,-0.13832
51.51050,-0.13876 51.51102,-0.14143 51.51405,-0.14187
51.51451,-0.14226 51.51570,-0.14226 51.51570,-0.14154
51.51524,-0.14157 51.51532,-0.14163 51.51532,-0.14178 51.51530)',
4326)

Thanks

James

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ishaya Bhatt 2013-10-30 09:53:29 Double Free or corruption
Previous Message James David Smith 2013-10-25 11:24:44 Re: COUNT and GROUP BY performing strangely