Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#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)

test_OGR_PostgreSQL_nogeom.zip (6.7 KB ) - added by lpercich 13 years ago.
Test PG schema, data and error log

Download all attachments as: .zip

Change History (3)

by lpercich, 13 years ago

Test PG schema, data and error log

comment:1 by Even Rouault, 13 years ago

Resolution: duplicate
Status: newclosed

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.

in reply to:  1 comment:2 by lpercich, 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

Note: See TracTickets for help on using tickets.