[postgis-users] addgeometrycolumn() does not exist

strk strk at keybit.net
Sun Jun 6 00:33:17 PDT 2004


On Sat, Jun 05, 2004 at 06:16:36PM -0700, Aaron Steele wrote:
> dear readers,
> 
> thanks for everyone's help. the solution turnout out to be a 
> combination of things. first i needed to load the sql interface 
> (postgis.sql, spatial_ref_sys.sql). then i needed to edit the resulting 
> sql file generated from shp2pgsl. all tuple variables containing '#' or 
> '-' required surrounding double quotes. after these changes, it worked.

Note that shp2pgsql supports a -k switch to quote all identifiers,
that should avoid you the second step.

--strk;

> 
> thanks,
> aaron
> 
> On Jun 4, 2004, at 5:32 PM, Gregory S. Williamson wrote:
> 
> >You needed to do the createlang, but also need some sql.
> >
> >There is a file of commands that actually loads the sql interface to 
> >the GIS functions called "postgis.sql" that you want to run for your 
> >database. You may also want to run the "spatial_ref_sys.sql" to 
> >populate the spatial references table. These two files are found in 
> >the contrib postgis directory (e.g. 
> >/usr/src/postgresql-7.4/contrib/postgis-0.8.0, or some such). There is 
> >a 3rd sql file used to delete the GIS stuff from the database.
> >
> >Greg Williamson
> >DBA
> >GlobeXPlorer LLC
> >
> >-----Original Message-----
> >From:	Aaron Steele [mailto:asteele at berkeley.edu]
> >Sent:	Fri 6/4/2004 5:25 PM
> >To:	PostGIS Users Discussion
> >Cc:	
> >Subject:	Re: [postgis-users] addgeometrycolumn() does not exist
> >hi paul,
> >
> >yes, i enabled pl/pgsql with 'createlang plpgsql <mydb>'. is this what
> >you mean?
> >
> >thanks,
> >aaron
> >
> >On Jun 4, 2004, at 5:06 PM, Paul Ramsey wrote:
> >
> >>Is it possible you have not enabled PostGIS by loading the postgis.sql
> >>file?
> >>
> >>Aaron Steele wrote:
> >>
> >>>dear readers,
> >>>i'm running postgresql 7.4.2 with postgis 0.8.1 on linux redhat 8.
> >>>i successfully converted a shapefile (cnty24k97.shp from
> >>>http://gis.ca.gov/BrowseCatalog.epl) into sql (shp2pgsql
> >>>cnty24k97.shp  counties mapitdb > counties.sql). while uploading it
> >>>to my database  (psql -d mapitdb -f counties.sql), i get this error:
> >>><error>
> >>>psql:counties.sql:1: ERROR:  syntax error at or near "#" at character
> >>>76
> >>>psql:counties.sql:2: ERROR:  function addgeometrycolumn("unknown",
> >>>"unknown", "unknown", integer, "unknown", integer) does not exist
> >>>HINT:  No function matches the given name and argument types. You may
> >>> need to add explicit type casts.
> >>>BEGIN
> >>>...
> >>>psql:counties.sql:174: ERROR:  syntax error at or near "#" at
> >>>character  51
> >>>psql:counties.sql:175: ERROR:  syntax error at or near "#" at
> >>>character  51
> >>>COMMIT
> >>>psql:counties.sql:176: ERROR:  relation "counties" does not exist
> >>>psql:counties.sql:177: ERROR:  relation "counties_gid_seq" does not
> >>>exist
> >>></error>
> >>>here is a snippit from the converted shapefile:
> >>><snippit>
> >>>CREATE TABLE counties (gid serial, AREA float8, PERIMETER float8,
> >>>CNTY24K97# int4, CNTY24K97- int4, NAME varchar, NAME_CAP varchar, NUM
> >>> int4, FIPS_CODE int4);
> >>>select
> >>>AddGeometryColumn('','counties','the_geom','-1','MULTIPOLYGON',2);
> >>>begin;
> >>>Insert into counties  (gid,AREA,PERIMETER,CNTY24K97#,CNTY24K97-
> >>>,NAME,NAME_CAP,NUM,FIPS_CODE,the_geom)
> >>>values('0','2625844992.000000','306174.219000','2','3','Del
> >>>Norte','DEL
> >>>NORTE','8','15',GeometryFromText('MULTIPOLYGON(((-346072.6875
> >>>440055.6875 ,-346105.3125 440068.65625 ,-346134.65625 440091.03125
> >>>,-346175.34375 440118.75 ,-346328.84375 440208.3125 ,-346462.90625
> >>>440279.8125 ,-346547.65625 440322.875 ,-346624.65625 440345.6875
> >>>,-346687.46875 440362.0625 ,-346797.8125 440381.90625 ,-346850.78125
> >>>440393 ,-346927.84375 440413.84375 ,-346956.21875 440425.6875
> >>>,-347058.15625 440439.78125 ,-347101.46875 440440.09375
> >>>,-347178.28125  440433.4375 ,-347243.34375 440432.40625
> >>>,-347343.28125 440426.46875  ,-347395.28125 440426.03125
> >>>,-347449.1875 440415.6875 ,-347486.875  440412.34375 ,-347517.9375
> >>>440396.8125 ,-347558.875 440385.0625  ,-347583.40625 440385.812...
> >>></snippit>
> >>>any thoughts?
> >>>thanks,
> >>>aaron
> >>>_______________________________________________
> >>>postgis-users mailing list
> >>>postgis-users at postgis.refractions.net
> >>>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >>
> >>-- 
> >>      __
> >>     /
> >>     | Paul Ramsey
> >>     | Refractions Research
> >>     | Email: pramsey at refractions.net
> >>     | Phone: (250) 885-0632
> >>     \_
> >>_______________________________________________
> >>postgis-users mailing list
> >>postgis-users at postgis.refractions.net
> >>http://postgis.refractions.net/mailman/listinfo/postgis-users
> >>
> >
> >
> >
> >_______________________________________________
> >postgis-users mailing list
> >postgis-users at postgis.refractions.net
> >http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list