Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#3682 closed defect (fixed)

Strange fieldlength in result of pgsql2shp

Reported by: postgispaul Owned by: robe
Priority: medium Milestone: PostGIS 2.3.3
Component: utils/loader-dumper Version: 2.0.x
Keywords: Cc:

Description

When I export a query to a shapefile, boolean columns are converted to logical fields with a length of 2.

Don't know if it is allowed by the shape/dbf specs, but arcgis isn't able to open them. Other tools (f.e. qgis) are opening them correctly though

it's this piece in http://svn.osgeo.org/postgis/trunk/loader/pgsql2shp-core.c if (pgfieldtype == 16) {

dbffieldtype = FTLogical; dbffieldsize = 2; dbffielddecs = 0;

}

Any particular reason for setting the length to 2? Svn history didn't show any changes there since the file was added.

Change History (12)

comment:1 by robe, 8 years ago

@pramsey, @strk

Any reason we set this to 2? Specs say Logical type should be 1

http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm


L Logical 1 byte - initialized to 0x20 (space) otherwise T or F.


comment:2 by robe, 8 years ago

Milestone: PostGIS 2.3.2PostGIS 2.4.0

comment:3 by robe, 7 years ago

Resolution: fixed
Status: newclosed

In 15381:

Boolean (FTLogical) should be 1 byte not 2 bytes
closes #3682 for PostGIS 2.4.0 (trunk)

comment:4 by robe, 7 years ago

postgispaul,

Can you try this out and see if it fixes your issue. I unfortunately don't have ArcGIS to test with. If it does and pramsey and strk have no issue with backporting, I can backport to 2.3 as well.

If you need windows binaries - you can get them from here in about an hour.

http://winnie.postgis.net/download/windows/pg96/buildbot/

I'm still troubleshooting the 32-bit runs, so the 32-bits are too old to test with. I assume you are runnning 64-bit so probably a non-issue.

comment:5 by postgispaul, 7 years ago

Ok, I'll try. A small first remark though: In the postgis-pg96-binaries-2.4.0devw64gcc48.zip there are 2 different libexpat-1.dll's

comment:6 by robe, 7 years ago

Are you referring to the one in the postgisgui folder vs. the one in bin?

The one in postgisgui is packaged with gtk. The one in bin is what I build GDAL against (so that ogrfdw has support for OSM files and other xmlish things).

Speaking of which I've got to update the gtk version.

comment:7 by postgispaul, 7 years ago

yes those are the 2 folders

comment:8 by robe, 7 years ago

If you look close enough you'll probably find a lot of redundant libraries. So I purposely stuffed all the shp2pgsql-gui (gtk stuff in a subfolder) so it wouldn't screw up the PostgreSQL bin folder. The versions of things are not guaranteed to be compatible between the two folders.

comment:9 by postgispaul, 7 years ago

There were indeed some duplicates, but the libexpat-1 was the only one with different sise/date.

The solution is indeed confirmed. ArcGis opens the shapes correctly now

comment:10 by robe, 7 years ago

Milestone: PostGIS 2.4.0PostGIS 2.3.3
Resolution: fixed
Status: closedreopened

I'm reopening this cause strk is okay with backporting as long as I add a regression test.

I'll close after I have backported and added a regression test.

comment:11 by robe, 7 years ago

Resolution: fixed
Status: reopenedclosed

In 15442:

Backport fixes for pgsql2shp for Boolean field length and quote escaping
Includes tests for both
Closes #3682
Closes #3701

comment:12 by robe, 7 years ago

In 15443:

Backport test sql script missed in last commit
References #3682 for 2.3.3
References #3701 for 2.3.3

Note: See TracTickets for help on using tickets.