[postgis-users] Difficulty importing example file nyc_buildings.sql

Ben Madin lists at remoteinformation.com.au
Wed Aug 17 17:39:16 PDT 2011


Bruce,

a couple of things :

$PATH won't help - the only program you are using is psql, and that is running. FWIW, I would put /usr/local/pgsql-9/0/bin into your path so you don't have to type the full command every time.

AddGeometryColumn is a PostGIS function - if you can run 

psql nyc

and from within psql try :

SELECT postgis_full_version();

that will provide a lot of information - if it works, and tells you something about postgis, put it here. I think someone else suggested looking to see if the function exists.

The second one is the database search_path. within the database you can have schema's, which are like subsets of the database. many people only ever use the default one (called 'public') but it is possible that you have more, or the dumped data has more. Just having a schema is no guarantee of being able to access it - you need to set search_path to whatever to access it. You can alter database nyc set search_path.

I think to be much more help, a reproducible example is going to be required, but they can be hard to produce, so you might need to at least provide the output of these commands from within psql:

\dn

\dt

SHOW search_path;

SELECT postgis_full_version();

and maybe the nyc_buildings.sql file, or the first 50 lines of it. 

cheers

Ben

On 17/08/2011, at 11:33 PM, bac at brucecallander.com wrote:

> Thanks to Ben Madin for  advice. I removed the apostrophes from the SRID in nyc_buildings.sql (using TextEdit) and re-ran the command
> 
> /usr/local/pgsql-9.0/bin/psql -f /Users/bacmac/nyc_buildings.sql nyc
> 
> Unfortunately it produced the same result:
> 
> BEGIN
> psql:/Users/bacmac/nyc_buildings.sql:3: NOTICE:  CREATE TABLE will create implicit sequence "nyc_buildings_gid_seq" for serial column "nyc_buildings.gid"
> psql:/Users/bacmac/nyc_buildings.sql:3: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "nyc_buildings_pkey" for table "nyc_buildings"
> CREATE TABLE
> psql:/Users/bacmac/nyc_buildings.sql:4: ERROR:  function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) does not exist
> LINE 1: SELECT AddGeometryColumn('','nyc_buildings','the_geom',2908,...
>                ^
> HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
> psql:/Users/bacmac/nyc_buildings.sql:5: ERROR:  current transaction is aborted, commands ignored until end of transaction block
> psql:/Users/bacmac/nyc_buildings.sql:6: ERROR:  current transaction is aborted … and so on.
> 
> I wonder if I need to adjust $PATH so that the function AddGeometryColumn is found? Even when I change directory to /usr/local/pgsql-9.0/bin my Mac cannot find psql if I type that command on its own. I always have to use the full pathname /usr/local/pgsql-9.0/bin/psql. Strange, because typing 'ls' after changing the directory brings up the complete list of files including psql.
> 
> Bruce Callander
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110818/b91a9903/attachment.html>


More information about the postgis-users mailing list