Opened 7 years ago

Closed 7 years ago

#4329 closed defect (invalid)

Several errors in utils/setup.php

Reported by: Frederik Claus Owned by: geocoding@…
Priority: minor Milestone:
Component: nominatim Version: 2.0
Keywords: Cc:

Description

I tried setting up nominatim according to the wiki entry and I came across several errors. Im running Ubuntu 10.10 with postgres 8.4 and osm2pgsql works if i do it by hand.

$oDB =& DB::connect(CONST_Database_DSN, false);
   if (!PEAR::isError($oDB)){
	fail('database already exists ('.CONST_Database_DSN.')');
  }

Terminates script if database does not exists which should not be the case if you want to create a new database.

I changed the following line

passthru($osm2pgsql.'  -lsc -O gazetteer -C 12000 --hstore -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file']);

to

passthru($osm2pgsql.' -s -d ' .$aDSNInfo['database'].' '.$aCMDResult['osm-file'])

Fails because the command line does take the argument --hstore.

With the compiled osm2pgsql I always get

usr/local/bin/osm2pgsql: error while loading shared libraries: libprotobuf-c.so.0: cannot open shared object file: No such file or directory

which I can solve in the user shell by adding

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

I recompiled but the problem seems to persist.

function pgsqlRunScript($sScript)
{
// Convert database DSN to psql paramaters
  $aDSNInfo = DB::parseDSN(CONST_Database_DSN);
  if (!isset($aDSNInfo['port']) || !$aDSNInfo['port'])   $aDSNInfo['port'] = 5432;
 $sCMD = 'psql -p '.$aDSNInfo['port'].' '.$aDSNInfo['database'].   '--no-password ';

I added --no-password to it and set the pg_hba.conf to local all ident and started the script with sudo -u www-data ./config/setup.php. Otherwise this will fail with failed user authentication or no password specified. If you want to get rid of the million password prompts as the script pipes the sql files.

Still on the old osm2psql (but the head one seems to have the same config).

$oDB =& getDB();
$x = $oDB->getRow('select * from planet_osm_point limit 1');
f (!$x || PEAR::isError($x)) fail('No Data');

will fail because there is not table place. osm2pgsql inserts planet_osm_point , etc. But no place and if you insert an empty prefix with -p "" it will still be _point.

A little later it died on me (note: still the old osm2psql) with no hstore error. I commented the hstore insert out, because the sql file is not present on my system and manual osm2pgsql did not complained about the lack of it.

I tried it again with the hstore.sql from the lucid postgres .deb package and the old osm2pgsql. Is the version important?. Here is the output. I made changes to the setup.php as descriped above. The output is shortened. The first line is right after using osm2pgsql which succeeded.

NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
ERROR:  type wordscore[] does not exist
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
ERROR:  type "addressline" does not exist
ERROR:  type "hstore" is only a shell
ERROR:  type "addressline" does not exist
ERROR:  type "place_boundingbox" does not exist
ERROR:  type "place_boundingbox" does not exist
ERROR:  type "place_boundingbox" does not exist
CONTEXT:  compilation of PL/pgSQL function "update_place" near line 2
ERROR:  syntax error at or near "$1"
LINE 1: insert into location_property_tiger (place_id,  $1 ,  $2 , h...
                                                        ^
QUERY:  insert into location_property_tiger (place_id,  $1 ,  $2 , housenumber, postcode, centroid) values (nextval('seq_place'),  $1 ,  $2 ,  $3 ,  $4 , ST_Line_Interpolate_Point( $5 , ( $3 ::float- $6 ::float)/ $7 ::float))
CONTEXT:  SQL statement in PL/PgSQL function "tigger_create_interpolation" near line 75
ERROR:  syntax error at or near "$1"
LINE 1: insert into location_property_aux (place_id,  $1 , parent_pl...
                                                      ^
QUERY:  insert into location_property_aux (place_id,  $1 , parent_place_id, housenumber, postcode, centroid) values (nextval('seq_place'),  $1 ,  $2 ,  $3 ,  $4 ,  $5 )
CONTEXT:  SQL statement in PL/PgSQL function "aux_create_property" near line 40
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
ERROR:  type wordscore[] does not exist
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
NOTICE:  argument type hstore is only a shell
ERROR:  PL/pgSQL functions cannot accept type hstore
ERROR:  type "addressline" does not exist
ERROR:  type "hstore" is only a shell
ERROR:  type "addressline" does not exist
ERROR:  syntax error at or near "$1"
LINE 1: insert into location_property_tiger (place_id,  $1 ,  $2 , h...
                                                        ^
QUERY:  insert into location_property_tiger (place_id,  $1 ,  $2 , housenumber, postcode, centroid) values (nextval('seq_place'),  $1 ,  $2 ,  $3 ,  $4 , ST_Line_Interpolate_Point( $5 , ( $3 ::float- $6 ::float)/ $7 ::float))
CONTEXT:  SQL statement in PL/PgSQL function "tigger_create_interpolation" near line 75
ERROR:  syntax error at or near "$1"
LINE 1: insert into location_property_aux (place_id,  $1 , parent_pl...
                                                      ^
QUERY:  insert into location_property_aux (place_id,  $1 , parent_place_id, housenumber, postcode, centroid) values (nextval('seq_place'),  $1 ,  $2 ,  $3 ,  $4 ,  $5 )
CONTEXT:  SQL statement in PL/PgSQL function "aux_create_property" near line 40
ERROR: DB Error: no such table

Change History (1)

comment:1 Changed 7 years ago by Sarah Hoffmann

Resolution: invalid
Status: newclosed

Please report only one issue per ticket and only report bugs. If you need help with the installation the geocoding@ or dev@ mailinglists are more suitable.

The syntax errors in --create-functions have been fixed. All other errors are related to your installation. Your version of osm2pgsql is far too old. Compile a recent version from subversion.

Note: See TracTickets for help on using tickets.