]> granicus.if.org Git - postgis/commitdiff
#1759 transform functionality doesn't work if you have raster installed.
authorRegina Obe <lr@pcorp.us>
Tue, 10 Apr 2012 00:20:05 +0000 (00:20 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 10 Apr 2012 00:20:05 +0000 (00:20 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9621 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-core.c

index d563b82e122227df6c9d3603d42941be206c08ea..f48c0d8ddbc4b0af15049205f116e9b9e3d2f557 100644 (file)
@@ -1724,7 +1724,13 @@ ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strreco
                                /* Close the ST_Transform if reprojecting. */
                                if (state->to_srid != state->from_srid)
                                {
-                                       stringbuffer_aprintf(sb, ", %d)", state->to_srid);
+                                       /* We need to add an explicit cast to geography/geometry to ensure that
+                                          PostgreSQL doesn't get confused with the ST_Transform() raster
+                                          function. */
+                                       if (state->config->geography)
+                                               stringbuffer_aprintf(sb, ", %d)::geography", state->to_srid);
+                                       else
+                                               stringbuffer_aprintf(sb, "::geometry, %d)", state->to_srid);
                                }
                        }