[GIS] Can’t import shapefile to PostGIS

importpostgisshapefile

I am using postgresql 9.4.1 and postgis 2.1(pg 94) and also qgis 2.4.0. All the installation went well. But, when I tried to import shapefile to postgis via postgis shp & dbf loader it couldn't work! Here is the warning message:

==============================

Importing with configuration: area, public, geom, D:\temp\area.shp,
mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=0
Shapefile type: Arc PostGIS type: MULTILINESTRING[2] Failed SQL
begins: "SET CLIENT_ENCODING TO UTF8; SET STANDARD_CONFORMING_STRINGS
TO ON; BEGIN; CREATE TABLE "public"."area" (gid serial, "objectid"
int4, "fid_block3" int4, "shape_leng" numeric); ALTER TABLE
"public"."area" ADD PRIMARY KEY (gid); SELECT AddGeometryColumn('pu"
Failed in pgui_exec(): ERROR: fungsi addgeometrycolumn(unknown,
unknown, unknown, unknown, unknown, integer) tidak ada LINE 9: SELECT
AddGeometryColumn('public','area','geom','0','MULTILI…
^

HINT: Tidak ada fungsi yang sesuai dengan nama dan tipe argumen yang
diberikan.Anda mungkin perlu menambakan cast tipe eksplisit

Shapefile import failed.

==============================

At first I thought it was because of my shapefile is broken. But it was not. I try to produce new shapefile and still couldn't import!
If anyone ever found the same case, please share your solution to me.

Oh ya, in addition, I also have tried the SPIT tools in qgis and still I can't import the shapefile with warning massage:

Problem inserting features from file:
D:/temp/for_postgres/poligon.shp

Error while executing the SQL:

SELECT f_table_name FROM geometry_columns WHERE
f_table_name='poligon' AND f_table_schema='public'

The database
said:ERROR: relasi « geometry_columns » sudah ada LINE 1: SELECT
f_table_name FROM geometry_columns WHERE f_table_name…^

Best Answer

I think that you have to configure postGIS library as extension in your database. Here an example.