]> granicus.if.org Git - postgis/commitdiff
Use "DROP TABLE IF EXISTS" on shp2pgsql -d
authorSandro Santilli <strk@keybit.net>
Thu, 21 Jul 2016 09:46:20 +0000 (09:46 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 21 Jul 2016 09:46:20 +0000 (09:46 +0000)
Patch by Eugene Antimirov
Closes #2236

git-svn-id: http://svn.osgeo.org/postgis/trunk@15005 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
loader/shp2pgsql-core.c

diff --git a/NEWS b/NEWS
index 09104d034965829c6af4a50d7ec02a23f3b38d17..89334b685d9495aa4c354a16891242c84da2684b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ PostGIS 2.3.0
   - populate_topology_layer (Sandro Santilli)
   - #454,  ST_WrapX and lwgeom_wrapx (Sandro Santilli)
   - #1758, ST_Normalize (Sandro Santilli)
+  - #2236, shp2pgsql -d now emits "DROP TABLE IF EXISTS"
   - #2259, ST_Voronoi (Dan Baston)
   - #2991, Enable ST_Transform to use PROJ.4 text (Mike Toews)
   - #3059, Allow passing per-dimension parameters in ST_Expand (Dan Baston)
index 224ece8c64581e238b34b9a1113c896fef652c35..8070179f53528c6fde14445e37000ba46dde4112 100644 (file)
@@ -1299,7 +1299,7 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
                                                     state->config->schema, state->config->table, state->geo_col);
                        }
 
-                       stringbuffer_aprintf(sb, "DROP TABLE \"%s\".\"%s\";\n", state->config->schema,
+                       stringbuffer_aprintf(sb, "DROP TABLE IF EXISTS \"%s\".\"%s\";\n", state->config->schema,
                                             state->config->table);
                }
                else
@@ -1310,7 +1310,7 @@ ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
                                                     state->config->table, state->geo_col);
                        }
 
-                       stringbuffer_aprintf(sb, "DROP TABLE \"%s\";\n", state->config->table);
+                       stringbuffer_aprintf(sb, "DROP TABLE IF EXISTS \"%s\";\n", state->config->table);
                }
        }