Opened 11 years ago
Closed 11 years ago
Last modified 11 years ago
#1759 closed defect (fixed)
shp2pgsql st_transform not unique requires casting
|Reported by:||robe||Owned by:||mcayland|
shp2pgsql is emitting code like this
If you use ST_Transform. However if you have raster installed in your db, you get an ST_Transform is not unique notice, because raster also has an ST_Transform function.
This needs to be changed to
See user posting: http://postgis.refractions.net/pipermail/postgis-users/2012-April/033534.html
Change History (9)
by , 11 years ago
comment:1 by , 11 years ago
|Component:||postgis → loader/dumper|
How about the attached patch which adds explicit casts for both geometry/geography and passes regression for me?
comment:2 by , 11 years ago
Works for me. Fill free to commit.
comment:3 by , 11 years ago
|Status:||new → closed|
Mark, Hope you don't mind I've committed at r9621 . I think this is an important fix and I would like to get out a 2.0.1 experimental windows build out sometime soon.
comment:4 by , 11 years ago
Just a note — I forgot to check the geography type to see if this works. We don't have an ST_Transform for geography so it may not work. I'll reopen if it doesn't work for geography.
comment:5 by , 11 years ago
Okay - I was away at my parents over Easter and their WiFi doesn't always work that well, so struggling to get internet access. The cast should be fine - for the first version of the patch, I added the cast inside ST_Transform() which tripped up one of the regression tests (thanks to strk for adding this for the new feature!) which is why the explicit cast now wraps everything.
comment:6 by , 11 years ago
|Status:||closed → reopened|
Evidentally I missed testing this on geography:
I tested with this command:
%SHP2PGSQL% -c -s 4269:4326 -G -g geog -W "latin1" tl_2010_42_zcta510 tiger_staging.zcta510_42 > zip.sql
And it needs to cast the geometry first before transforming so I guess you need to make the same change for geography.
and needs to produce:
comment:7 by , 11 years ago
|Status:||reopened → closed|
comment:8 by , 11 years ago
Looks fine to me. I was just about to post that I couldn't reproduce this, however I see that I didn't have rtpostgis.sql loaded into my test database which is why I didn't pick up on this before.
Fix ST_Transform for shp2pgsql