I run command:
ogr2ogr -f PostgreSQL PG:"dbname=regional host=localhost user=*** password=***" Hsp_09_13.MIF -t_srs EPSG:3857 -nlt MULTIPOLYGON -overwrite -nln postcode_sector_boundaries
And I have error:
ERROR 1: Layer postcode_sector_boundaries already exists, CreateLayer failed. Use the layer creation option OVERWRITE=YES to replace it.
So I run this command then:
ogr2ogr -f PostgreSQL PG:"dbname=regional host=localhost user=*** password=***" Hsp_09_13.MIF -t_srs EPSG:3857 -nlt MULTIPOLYGON -lco OVERWRITE=YES -overwrite -nln postcode_sector_boundaries
and got error:
ERROR 1: CREATE TABLE "public"."postcode_sector_boundaries" ( OGC_FID SERIAL, PRIMARY KEY (OGC_FID) ) ERROR: relation "postcode_sector_boundaries" already exists
So I remove table
postcode_sector_boundaries and run once more last command and got:
ERROR 1: 'CREATE INDEX "postcode_sector_boundaries_geom_idx" ON "public"."postcode_sector_boundaries" USING GIST ("wkb_geometry")' failed for layer postcode_sector_boundaries, index creation has failed.
postcode_sector_boundaries_geom_idx is unique key so I think that maybe my data are broken. I would like that ogr2ogr create table without that index but I can not find where definition for this create query can be. Any one knows? Or maybe there is another solution for my problem?
Ok, I know what was the problem - it was because there were some other tables using values from one I wanted recreate.