Bug report #4869

error when dropping a shape into a PG connection

Added by Giovanni Manghi over 12 years ago. Updated almost 11 years ago.

Status:Closed
Priority:High
Assignee:-
Category:DB Manager
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:14697

Description

The attached shape has a CRS that is seen by QGIS as custom (it is in truth the old epsg 3763).

When I drop the layer in a PG connection without specifying the "source srid" and "target srid" (that in these cases DB manager shows as "0") I get this

Creation of data source "public"."topo_c" failed:
ERROR: AddGeometryColumns() - invalid SRID
CONTEXT: SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement

topo_c_shp.zip (13.5 KB) Giovanni Manghi, 2012-01-24 06:00 AM

History

#1 Updated by Giuseppe Sucameli about 12 years ago

The layer srid is not recognized by QGis so it is set to 0.
PostGIS < 2.0 uses -1 as undefined and probably it doesn't understand 0.

Possible solutions:
- add a warning asking to the user to set the correct srid (pros: asking is ever good, cons: too much dialog opened)
- set it to -1 (pros: it works for PostGIS < 2.0 but also for PostGIS >= 2.0 because -1 is kept for compatibility, cons: the user is not alerted).

#2 Updated by Giovanni Manghi about 12 years ago

  • Priority changed from Normal to Low

Giuseppe Sucameli wrote:

The layer srid is not recognized by QGis so it is set to 0.
PostGIS < 2.0 uses -1 as undefined and probably it doesn't understand 0.

Possible solutions:
- add a warning asking to the user to set the correct srid (pros: asking is ever good, cons: too much dialog opened)
- set it to -1 (pros: it works for PostGIS < 2.0 but also for PostGIS >= 2.0 because -1 is kept for compatibility, cons: the user is not alerted).

As user I would prefer both, but if I have to choose I would say the second one.

#3 Updated by Paolo Cavallini about 12 years ago

  • Priority changed from Low to High

#4 Updated by Giovanni Manghi over 11 years ago

  • Affected QGIS version set to master
  • Crashes QGIS or corrupts data set to No
  • Project changed from 27 to QGIS Application

#5 Updated by Giovanni Manghi over 11 years ago

  • Category set to DB Manager

#6 Updated by Giovanni Manghi over 11 years ago

  • Assignee deleted (Giuseppe Sucameli)

#7 Updated by Giovanni Manghi almost 11 years ago

  • Status changed from Open to Closed
  • Resolution set to worksforme

Also available in: Atom PDF