#2236 closed enhancement (fixed)
shp2pgsql -d: can it emit "DROP TABLE IF EXISTS"?
Reported by: | pclark | Owned by: | robe |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.3.0 |
Component: | utils/loader-dumper | Version: | 2.0.x |
Keywords: | shp2pgsql, gsoc | Cc: |
Description
Can shp2pgsql emit DROP TABLE IF EXISTS instead of just DROP TABLE when the -d flag is passed?
Attachments (1)
Change History (14)
comment:1 by , 12 years ago
Milestone: | PostGIS Future → PostGIS 2.0.4 |
---|---|
Owner: | changed from | to
comment:2 by , 11 years ago
Milestone: | PostGIS 2.0.4 → PostGIS 2.2.0 |
---|
comment:3 by , 11 years ago
Keywords: | gsoc added |
---|
comment:4 by , 9 years ago
Milestone: | PostGIS 2.2.0 → PostGIS 2.3.0 |
---|
comment:5 by , 8 years ago
Hi everyone,
So, just to get it right. The only thing to be changed here is to add 'IF EXISTS' into the SQL statement and this ticket can be closed? Why has it taken this long then? Any hidden complications?
comment:6 by , 8 years ago
Lack of time from core committers, I guess. Consider attaching a patch, so it takes less time. Especially if you include a testcase (see regress/loader).
by , 8 years ago
Attachment: | shp2pgsql-core.c_IF_EXISTS.patch added |
---|
Added "IF EXISTS" to DROP TABLE statements
comment:7 by , 8 years ago
Hi strk,
I could not find how to add a testcase for -d option of the command itself, because it's not just the data that can be imported or exported. But the patch is pretty simple, you can see yourself.
comment:8 by , 8 years ago
loader tests can have a -pre and -post script, plus an -opt (somethign like that). So you could specify -d in the -opt file and either create or not a table with -pre (would be two tests, one with the table and one w/out). The data you could reuse existing one.
follow-up: 11 comment:9 by , 8 years ago
Eugene, your "Common Name" in LDAP lacks a surname: http://www.osgeo.org/cgi-bin/ldap_web_search.py?query=antimirov Consider fixing that via https://www.osgeo.org/cgi-bin/auth/ldap_edit_user.py (I went looking it up for attribution on applying the patch)
comment:11 by , 8 years ago
Replying to strk:
Eugene, your "Common Name" in LDAP lacks a surname: http://www.osgeo.org/cgi-bin/ldap_web_search.py?query=antimirov Consider fixing that via https://www.osgeo.org/cgi-bin/auth/ldap_edit_user.py (I went looking it up for attribution on applying the patch)
I think I fixed it.
Thanks for accepting the patch.
seems simple enough. I think all versions we support in 2.0 (8.4-9.2) support DROP TABLE IF EXISTS. Prior versions didn't which I suspect is why we didn't have it.
I think this is also something we can do in 2.0.4 instead of waiting for 2.1.0 because it doesn't change the api and is more the expected behavior