Opened 11 years ago

Closed 11 years ago

#2591 closed defect (worksforme)

shp2pgsql field length problem

Reported by: agnar Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.9
Component: postgis Version: 1.5.X
Keywords: Cc:

Description

Bug found on shp2pgsql (5098 2010-01-04). My version is recently installed on a Debian server using apt. It might not be the newest version, but the bug may still exist?

My shape file contained a field of type text(20). The corresponding sql-file contained a corresponding declaration of varying(20).

Subsequent inserts of records having exact 20 characters for that field failed. Editing the sql file to varying(21) resolved the problem.

But I would expect shp2pgsql to handle this eventuality.

Change History (3)

comment:1 by robe, 11 years ago

I've seen this problem before in PostgreSQL. Usually has to do with encoding.

What encoding did you assume for the file and what is the encoding of your dataase?

Also what version of PostgreSQL are you running?

comment:2 by pramsey, 11 years ago

Attach a test file to the ticket if you require a fix.

comment:3 by pramsey, 11 years ago

Resolution: worksforme
Status: newclosed

I'm going to guess UTF-8 data, so that the high-bit characters take 2bytes, so sometimes a 20-long string ends up as 21. Without pre-scanning the whole file, it's not really fixable. I'd like to see a test file.

Note: See TracTickets for help on using tickets.