ogr2ogr -overwrite does not work if target is PostGIS table which name begins with "pg"
|Reported by:||niccolo||Owned by:||chaitanya|
Running ogr2ogr with option -overwrite and destination a PostGIS table which name begins with "pg": it does not execute the DROP TABLE statement, causing a subsequent PostgreSQL error:
ERROR: relation "pgip_zone_2008" already exists
The problem is in ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp: when searching for tables it imposes:
c.relname !~ '^pg'
I suppose it is to to skip PostgreSQL system tables, but this skips also user tables.
A slightly better approach is to skip "^pg_" prefix, but I suppose it can be even better.