Opened 13 years ago
Last modified 13 years ago
#4012 closed defect
OGR2OGR - Postgre import with -nlt flag set to NONE doesn't create a record in geometry_columns anymore — at Version 3
Reported by: | hsenot | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.8.1 |
Component: | OGR_SF | Version: | 1.8.0 |
Severity: | normal | Keywords: | ogr2ogr pg |
Cc: |
Description (last modified by )
The following command has different results in different versions of the driver:
ogr2ogr -f "PostgreSQL" %CS% "test.tab" -nlt NONE -nln test_table
where:
- test.tab is a MapInfo file containing a non-spatial layer (just a regular table)
- CS="PG:host='localhost' port='54321' dbname='test_ogr' user='test_ogr' password='test_ogr'"
In GDAL 1.7.1, released 2010/02/08, a record is inserted in geometry_columns. But in both in:
- GDAL 1.8.0, released 2011/01/12
- GDAL 1.9dev, released 2011/01/18
no record is inserted.
This makes it difficult to use OGR2OGR to update/append non-spatial objects. The driver looks for a record in geometry_columns to choose between a create statement (if no record) or an update statement (if record exists) - with the behaviour of driver >= 1.8, it attempts a create on an existing table and thus fails the ogr2ogr statement.
Change History (8)
by , 13 years ago
Attachment: | test_PG.bat added |
---|
comment:1 by , 13 years ago
Version: | unspecified → 1.8.0 |
---|
comment:2 by , 13 years ago
Component: | default → OGR_SF |
---|---|
Keywords: | pg added |
Owner: | changed from | to
Hum, I think it might be due to r20471. You can try workarounding your issues by defining the environment variable PG_LIST_ALL_TABLES to YES. See http://gdal.org/ogr/drv_pg_advanced.html
I might consider reverting the controversial part of this changeset to restore previous behaviour. I somehow remembered it fixed an issue, perhaps the creation of tables with NONE geometry type that no longer worked at that point of the 1.8.0 development, but I need to do more testing both in the Postgis-enabled database and non postgis-enable database cases.
comment:3 by , 13 years ago
Description: | modified (diff) |
---|
I think that tables without geometry (ie. -nlt NONE) should *not* be in the geometry_columns table but perhaps we need some logic to avoid the failure you are seeing. I'm not planning on taking any action myself - I just wanted to put a stake in the ground with regard to non-spatial tables and geometry_columns.
Windows script to reproduce behaviour