Opened 10 years ago

Closed 10 years ago

#4177 closed defect (invalid)

Can't append to a PostGIS table with no geometry

Reported by: timneedham Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords: ogr2ogr append no geometry


OGR2OGR 1.9:

If you create a PostGIS layer using OGR2OGR that has no geometry, then subsequently try to -append data to it you get:

ERROR 1: Layer xxxxx already exists, CreateLayer? failed.

I'm importing gzipped GML into PostGIS.

The actual data being imported is Ordnance Survey (UK) mastermap... which contains many layers, two of which (road and roadlinkinformation) do not have geometry data associated with them.

There is a workaround... It seems ogr2ogr only considers PostGIS tables to "exist" if they're registered in public.geometry_columns, so by creating dummy records in there everything works.

  • Brilliant product by the way! :)

Change History (1)

comment:1 Changed 10 years ago by Even Rouault

Resolution: invalid
Status: newclosed

There are several other possibilities :

  • define the PG_LIST_ALL_TABLES configuration option/environment variable to YES, as documented in ("Layers" section), when you open the datasource
  • or define the layer creation option (-lco with ogr2ogr) NONE_AS_UNKNOWN to YES, as documented in, to force non-spatial tables to be considered as spatial tables. Of course the geometry column will always be empty, but the table will be registered into geometry_columns and hence visible when you open the datasource.

So I consider there's no further action needed.

Note: See TracTickets for help on using tickets.