[postgis-users] Newbie: search_path variable

Michael Papet mpapet at yahoo.com
Fri Nov 9 09:46:07 PST 2012

More on this pprint_addy issue.  The search_path variable appears to not be set correctly.  I have "$user", public, topology, tiger, tiger_data, tiger_staging as the search_path value for the geocoder database.

I took the query that makes the tiger.pprint_addy function and altered it so the pprint_addy function gets made in public.pprint_addy and now pprint_addy function works correctly.  

Attempts to use the geocode example from here http://postgis.refractions.net/docs/Geocode.html with Tiger2011 data return nothing.  No errors.

 From: Michael Papet <mpapet at yahoo.com>
To: "postgis-users at lists.osgeo.org" <postgis-users at lists.osgeo.org> 
Sent: Friday, November 9, 2012 9:28 AM
Subject: Re: Newbie: census_loader.sql Issue

I discovered another table not made tiger.tract.  Again, no error.  It just doesn't get made.

I used the included script to load Massachusetts data to use the documentation examples and am having more issues. 

#1: Select Function pprint_addy example does not work.  Function pprint_addy is present as pprint_addy(tiger.norm_addy).   I can run SELECT normalize_address('202 East Fremont Street, Las Vegas, Nevada 89101')) As pretty_address; and it returns a formatted address.

 SELECT pprint_addy(normalize_address('202 East Fremont Street, Las Vegas, Nevada 89101')) As pretty_address;
2012-11-09 08:36:50 PST ERROR:  function pprint_addy(norm_addy) does not exist at character
2012-11-09 08:36:50 PST HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

#2 the geocode example returns nothing.  No error.  Just no results.
SELECT g.rating, ST_X(g.geomout) As lon, ST_Y(g.geomout) As lat, 
    (addy).address As stno, (addy).streetname As street, 
    (addy).streettypeabbrev As styp, (addy).location As
 city, (addy).stateabbrev As st,(addy).zip 
    FROM geocode('75 State Street, Boston MA 02109') As g; 

The search_path for the database geocoder is set to include tiger, tiger_data, public, topology.  Do I need to add those names to the search_path variable value for database postgres?


 From: Michael Papet <mpapet at yahoo.com>
To: "postgis-users at lists.osgeo.org" <postgis-users at lists.osgeo.org> 
Sent: Thursday, November 8, 2012 8:04 AM
Subject: Newbie: census_loader.sql Issue

 This is an update on my issues loading Tiger2011 data to postGIS using Debian's Wheezy, Postgresql 9.1.  After starting over from the beginning, I'm down to one error loading data using the included loader scripts as-is. Table tiger.bg doesn't get made on my system with no clue that bg didn't get made unless I check my log file.

psql -d geocoder  -f /home/postgis/postgis/postgis-2.1.0SVN/extras/tiger_geocoder/tiger_2011/census_loader.sql                    setsearchpathforinstall
 tiger has been
 made primary for install
(1 row)

psql:/home/postgis/postgis/postgis-2.1.0SVN/extras/tiger_geocoder/tiger_2011/census_loader.sql:108: NOTICE:  function loader_generate_census(text[],text) does not exist, skipping

There's no bg table made.  If I change the stanza from CREATE TABLE bg to CREATE TABLE tiger.bg, there's still nothing made and no error in postgresql logs!  If I take the bg table query out and put it in an editor without the RETURN stanza, the table is made.

Here's the error from the logs using CREATE TABLE bg

2012-11-08 07:30:20 PST ERROR:  syntax error at or near "RETURN" at character 806
2012-11-08 07:30:20 PST STATEMENT:  CREATE TABLE bg
                  gid serial NOT NULL,
                  statefp varchar(2),
                  countyfp varchar(3),
                  tractce varchar(6),
                  blkgrpce varchar(1),
                  bg_id varchar(12) PRIMARY KEY,
                  mtfcc varchar(5),
                  funcstat varchar(1),
                  aland double precision,
                  awater double precision,
                  intptlat varchar(11),
                  intptlon varchar(12),
                  CONSTRAINT enforce_dims_geom CHECK (st_ndims(the_geom) = 2),
                  CONSTRAINT enforce_geotype_geom CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL),
                  CONSTRAINT enforce_srid_geom CHECK (st_srid(the_geom) = 4269)
                COMMENT ON TABLE tiger.bg IS 'block groups';
                RETURN 'Done creating census tract base tables - $Id: census_loader.sql 10179
 2012-08-13 21:45:39Z robe $';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121109/93ea77b5/attachment.html>

More information about the postgis-users mailing list