#4036 closed defect (duplicate)
PostGIS driver issues a CREATE TABLE when appending a non-geometric MapInfo table
Reported by: | lpercich | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | svn-trunk |
Severity: | normal | Keywords: | MapInfo, PostGIS |
Cc: |
Description
I'm trying to insert a MapInfo table into a PostgreSQL table, both having no geometry column:
ogr2ogr -append -update -f 'PostgreSQL' "PG:dbname=$dbname user=$dbuser password=$dbpassword active_schema=$dbschema" "data/NoGeomTest.TAB" -nlt NONE -lco LAUNDER=NO
The following error is returned (see error.log in attached zip):
ERROR 1: CREATE TABLE "loader"."NoGeomTest" ( OGC_FID SERIAL, CONSTRAINT "NoGeomTest_pk" PRIMARY KEY (OGC_FID) ) ERROR: relation "NoGeomTest" already exists
I Tried with both --config PG_USE_COPY YES and NO
I guess the driver looks into public.geometry_columns to see wether the table already exists. The "-nlt NONE" switch does not work here; for consistency with the PGDump driver, maybe it could be used for telling PG to ignore geometry?
I attach test data, PG schema and error log.
Attachments (1)
Change History (3)
by , 13 years ago
Attachment: | test_OGR_PostgreSQL_nogeom.zip added |
---|
follow-up: 2 comment:1 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
When trying your script it works for me, so I think this is a duplicate of #4012
As a workaround, when working with non-spatial tables, you have to specify --config PG_LIST_ALL_TABLES YES so that the OGR PG driver takes into account all existing tables, and not only the ones registered in the geometry_columns table, which is the default.
comment:2 by , 13 years ago
Replying to rouault:
When trying your script it works for me, so I think this is a duplicate of #4012
After a svn checkout from trunk works for me too. Sorry I was previously working on the 1.9dev source tarball downloaded last week and wasn't up to date.
As a workaround, when working with non-spatial tables, you have to specify --config PG_LIST_ALL_TABLES YES so that the OGR PG driver takes into account all existing tables, and not only the ones registered in the geometry_columns table, which is the default.
I see. I tested this with the previous version and works fine. The latest version as expected works well with or without PG_LIST_ALL_TABLES being set.
Thanks again
Sig
Test PG schema, data and error log