Opened 18 years ago
Last modified 18 years ago
#1018 closed defect (fixed)
ogr2ogr -f PostgreSQL -- "AddGeometryColumn" error
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SRS | Version: | unspecified |
Severity: | critical | Keywords: | |
Cc: |
Description
GDAL version: 1.3.1 PostGIS version: 1.0 PostgreSQL version: 7.4.7 BUG: in gdal-1.3.1/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp There is an error in file gdal-1.3.1/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp caused by an erroneus fetch of 1st. parameter in PostGIS function AddGeometryColumn (and DropGeometryColumn, too). In old PostgreSQL/PostGIS this was not important (this parameter was unused), but in newer versions must be the SCHEMA name, not the database name. AddGeometryColumn usage: AddGeometryColumn(schema, table, column, srid, type, dimension); short version (modifies the table in the default schema): AddGeometryColumn(table, column, srid, type, dimension); DropGeometryColumn usage: DropGeometryColumn(schema, table, column) short v.: DropGeometryColumn(table, column) While there is no option for SCHEMA in ogr2ogr, a provisional -and succesful- FIX is: Diff new_file old_file output: 544c544 < "SELECT DropGeometryColumn('%s','wkb_geometry')", --- > "SELECT DropGeometryColumn('%s','%s','wkb_geometry')", 546,547d545 < /* "SELECT DropGeometryColumn('%s','%s','wkb_geometry')", < pszDBName, pszLayerName ); */ 756,759c754,755 < "select AddGeometryColumn('%s','wkb_geometry',%d,'%s',%d)", < pszLayerName, nSRSId, pszGeometryType, < /* "select AddGeometryColumn('%s','%s','wkb_geometry',%d,'%s',%d)", < pszDBName, pszLayerName, nSRSId, pszGeometryType, */ --- > "select AddGeometryColumn('%s','%s','wkb_geometry',%d,'%s',%d)", > pszDBName, pszLayerName, nSRSId, pszGeometryType,
Note:
See TracTickets
for help on using tickets.