Ticket #1426 (closed defect: fixed)
OGR2OGR fails importing data to postgis
| Reported by: | anguscarr | Owned by: | pramsey |
|---|---|---|---|
| Priority: | low | Milestone: | PostGIS 2.0.0 |
| Component: | postgis | Version: | trunk |
| Keywords: | ogr2ogr, import | Cc: |
Description
When I run ogr2ogr, I get:
C:\Temp>"c:\program files\gdal\ogr2ogr" -f "PostgreSQL" PG:"host=127.0.0.1 user=apc dbname=FMP port=5433" -nln black_spruce_2011.aoc01 c:\temp\tmpsqqk3e PAL ERROR 1: AddGeometryColumn failed for layer black_spruce_2011.aoc01, layer creation has failed. ERROR 1: Terminating translation prematurely after failed translation of layer PAL (use -skipfailures to skip errors)
I had a look into the DB logs, and got this:
ERROR: cannot delete from view "geometry_columns" HINT: You need an unconditional ON DELETE DO INSTEAD rule or an INSTEAD OF DELETE trigger. STATEMENT: DELETE FROM geometry_columns WHERE f_table_name = 'aoc01' AND f_table_schema = 'black_spruce_2011' ERROR: current transaction is aborted, commands ignored until end of transaction block
For the short term, I added this rule:
CREATE OR REPLACE RULE ogr2ogr_delete_problem AS ON DELETE TO public.geometry_columns DO INSTEAD NOTHING ;
Obviously, that's not a long-term solution, but I don't think I should fix it without looking to the larger community. I assume this is an OGR2OGR bug, but since my fix of the day is on my DB, I thought I would post here.
Is it safe to leave this rule in place for the long term? Right now, I am loading data into an empty db, and it's ok for now.
Change History
Note: See
TracTickets for help on using
tickets.
