Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I was trying to import shp to postgis database and i get the following error:

Importing with configuration: adresy92, public, geom, C:\Users\tomek\Desktop\adresy92, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=0
Shapefile type: PointZ
PostGIS type: POINT[4]
CREATE TABLE "public"."adresy92" (gid serial,
"obrot" int2,
"dane_kod" int2,
"xy_dane" varchar(20),
"status_kod" int2,
"xy_status" varchar(50),
"ulica_kod" int2,
"miejsc_kod" int2"
Failed in pgui_exec(): ERROR:  AddGeometryColumns() - invalid SRID
CONTEXT:  SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement
Shapefile import failed.

The stange thing is that I have already put a couple shapefiles to this database without any problems.

I am importing shapefile through SPIT tool from Quantum GIS 1.8.0.

I have also tried to do the same via shp2pgsql plugin in pgAdmin with the same result.

PS I found a similar question on gis.stackexchange but it didn't solve my problem.

I would be appreciate for your help.

share|improve this question
Make sure the SRID (CRS) you are using in QGIS is in the spatial_ref_system table. – Scro Jul 9 '12 at 12:04
It is for sure, because all the previous data is in the same SRID. – com Jul 9 '12 at 12:39
And yet in the error message above it says srid=0 ?? – Micha Jul 11 '12 at 13:53
Yes. The srid=0. But now I get the solution on my own. The problem was that when i import shp (in SPIT tool) the geometry was as NULL. So i look at the shape in ArcGIS and there was a PointZM as the geometry column- i converse it to normal point value and then everything goes ok when try to import to PostGIS. So the problem is solved. Thank you all. – com Jul 13 '12 at 11:10
my guess: When a geometry isn't valid perhaps perhaps QGIS thinks it belongs in a different SRID. Vector>Geometery Tools>check geometery validity on the shapefile to see. I believe something similar happened to me with spatialite – user12711 Jun 20 '13 at 13:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.