From: Sandro Santilli Date: Thu, 21 Jul 2016 09:46:20 +0000 (+0000) Subject: Use "DROP TABLE IF EXISTS" on shp2pgsql -d X-Git-Tag: 2.3.0beta1~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33fb0c9e91b09297e4f4f2246d0f8f54703a9b75;p=postgis Use "DROP TABLE IF EXISTS" on shp2pgsql -d Patch by Eugene Antimirov Closes #2236 git-svn-id: http://svn.osgeo.org/postgis/trunk@15005 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index 09104d034..89334b685 100644 --- 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) diff --git a/loader/shp2pgsql-core.c b/loader/shp2pgsql-core.c index 224ece8c6..8070179f5 100644 --- a/loader/shp2pgsql-core.c +++ b/loader/shp2pgsql-core.c @@ -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); } }