<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16443"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>Smaran,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>This error usually happens for one of 2
reasons</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>1) You are trying to import into a database that is not
PostGIS enabled</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>2) You installed PostGIS in a schema other than public and did
not add that schema to your search_path. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>(this you can fix by adding the schema to your database search
path -- pgAdmin has it under variables, or you can run something
like</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>ALTER DATABASE set
search_path=public,the_schema_you_installed_postgis_in</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>To verify one of these is the issue run this
command:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>SELECT postgis_full_version();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>If it fails one of the above is usually the
reason.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>Couple of comments to answer your
questions</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>1) You shouldn't have postgis installed in your postgres
database.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>2) You can install postgis in as many databases as you
want </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>If you are on PostgreSQL 9.1 and are running PostGIS 2.0 just
run the SQL statement</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>CREATE EXTENSION postgis;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>in the database you want to install it in.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>If you are in a lower database or lower
PostGIS</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>you can create a new database and use template_postgis or
template_postgis20 as your template.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial><A
href="http://www.postgis.us">http://www.postgis.us</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=021061223-17052012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV><FONT color=#0000ff size=2
face=Arial></FONT><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Smaran Harihar<BR><B>Sent:</B> Thursday, May 17, 2012 3:08
PM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> [postgis-users]
Unable to import shapefile using Shapefile toPostGIS
Importer<BR></FONT><BR></DIV>
<DIV></DIV>Hi I am trying to import shapefile into the Postgres database that
I created in PGAdmin3 using the Shapefile to PostGIS Importer and despite the
connection being successful I am receiving the following error,
<DIV><BR></DIV>
<DIV>
<DIV><FONT color=#ff0000>Connection: host=localhost port=5432 user=admin
dbname=shpRepo password='**********' </FONT></DIV>
<DIV><FONT color=#ff0000>Destination: public.AllQuebecSpecies</FONT></DIV>
<DIV><FONT color=#ff0000>Source File:
/home/smaranh/development/Biodiversity/biodiversity/shapefile/AllQuebecSpecies</FONT></DIV>
<DIV><FONT color=#ff0000>Shapefile type: Point</FONT></DIV>
<DIV><FONT color=#ff0000>Postgis type: POINT[2]</FONT></DIV>
<DIV><FONT color=#ff0000>Failed SQL begins: "SET CLIENT_ENCODING TO
UTF8;</FONT></DIV>
<DIV><FONT color=#ff0000>SET STANDARD_CONFORMING_STRINGS TO ON;</FONT></DIV>
<DIV><FONT color=#ff0000>BEGIN;</FONT></DIV>
<DIV><FONT color=#ff0000>CREATE TABLE "public"."AllQuebecSpecies" (gid serial
PRIMARY KEY,</FONT></DIV>
<DIV><FONT color=#ff0000>"family" varchar(50),</FONT></DIV>
<DIV><FONT color=#ff0000>"species" varchar(50));</FONT></DIV>
<DIV><FONT color=#ff0000>SELECT
AddGeometryColumn('public','AllQuebecSpecies','the_geom','-1"</FONT></DIV>
<DIV><FONT color=#ff0000>Failed in pgui_exec(): ERROR: function
addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does
not exist</FONT></DIV>
<DIV><FONT color=#ff0000>LINE 7: SELECT
AddGeometryColumn('public','AllQuebecSpecies','the_ge...</FONT></DIV>
<DIV><FONT color=#ff0000>
^</FONT></DIV>
<DIV><FONT color=#ff0000>HINT: No function matches the given name and
argument types. You might need to add explicit type casts.</FONT></DIV>
<DIV><FONT color=#ff0000><BR></FONT></DIV>
<DIV><FONT color=#ff0000>Shapefile import failed.</FONT></DIV>
<DIV><BR></DIV>
<DIV>Also I am new to PostGIS and Postgres so this might sound very dumb
question but if I create a new database in pgadmin3, is it postgres database
or postgis db? If it is postgres db then probably that is why shape file is
not able to be imported since it can only be imported into PostGIS db (i
think). So how can i convert a Postgres db to PostGIS?</DIV>
<DIV><BR></DIV>-- <BR>Thanks & Regards
<DIV>Smaran Harihar</DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>