dbTalk Databases Forums  

Trouble on building PostGIS support

comp.databases.postgresql comp.databases.postgresql


Discuss Trouble on building PostGIS support in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Frank Glück
 
Posts: n/a

Default Trouble on building PostGIS support - 01-10-2009 , 07:32 AM






Hi,

on executing this command, I got from a German PostGIS installing tutorial (
http://wiki.osgeo.org/wiki/Installat...f_Debian_4.0):

psql -d template1 -f
/var/src/postgresql-8.1.11/contrib/postgis/lwpostgis.sql

on line 70 I get the error, that type "histogram2d" would already exist.
Here comes the first part of this "lwpostgis.sql":

==================================================


-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
-- $Id: lwpostgis.sql.in 2707 2007-09-06 16:03:56Z mcayland $
--
-- PostGIS - Spatial Types for PostgreSQL
-- http://postgis.refractions.net
-- Copyright 2001-2003 Refractions Research Inc.
--
-- This is free software; you can redistribute and/or modify it under
-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
-- WARNING: Any change in this file must be evaluated for compatibility.
-- Changes cleanly handled by lwpostgis_uptrade.sql are fine,
-- other changes will require a bump in Major version.
-- Currently only function replaceble by CREATE OR REPLACE
-- are cleanly handled.
--
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -










BEGIN;

-------------------------------------------------------------------
-- HISTOGRAM2D TYPE (lwhistogram2d)
-------------------------------------------------------------------


-- Deprecation in 1.2.3
CREATE OR REPLACE FUNCTION histogram2d_in(cstring)
RETURNS histogram2d
AS '$libdir/liblwgeom', 'lwhistogram2d_in'
LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict);

-- Availability: 1.2.2
CREATE OR REPLACE FUNCTION ST_histogram2d_in(cstring)
RETURNS histogram2d
AS '$libdir/liblwgeom', 'lwhistogram2d_in'
LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict);

-- Deprecation in 1.2.3
CREATE OR REPLACE FUNCTION histogram2d_out(histogram2d)
RETURNS cstring
AS '$libdir/liblwgeom', 'lwhistogram2d_out'
LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict);

-- Availability: 1.2.2
CREATE OR REPLACE FUNCTION ST_histogram2d_out(histogram2d)
RETURNS cstring
AS '$libdir/liblwgeom', 'lwhistogram2d_out'
LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict);

CREATE TYPE histogram2d (
alignment = double,
internallength = variable,
input = ST_histogram2d_in,
output = ST_histogram2d_out,
storage = main
);
==================================================


Maybe the definition of this "histogram2d" happend on a former trial to read
in this file. But, if so, I'm really helpless, how to clean this faulty
basis. I already tried to remove the template1-database intended to recreate
it, but the error comes again. Are these commands in the "lwpostgis.sql"
faulty?

Thanks a lot and greetings,
Frank



Reply With Quote
  #2  
Old   
Armin Saul
 
Posts: n/a

Default Re: Trouble on building PostGIS support - 01-10-2009 , 01:18 PM






Frank Glück schrieb:
Quote:
Hi,

on executing this command, I got from a German PostGIS installing tutorial (
http://wiki.osgeo.org/wiki/Installat...f_Debian_4.0):

psql -d template1 -f
/var/src/postgresql-8.1.11/contrib/postgis/lwpostgis.sql

on line 70 I get the error, that type "histogram2d" would already exist.
Here comes the first part of this "lwpostgis.sql":

==================================================


-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Have a look at

http://www.postgresql.org/docs/8.1/i...mplatedbs.html

and start with a "clean" template1.

If you want to add postgis-functionality to a database (foo), use the
following commands:

createlang -U postgres plpgsql foo

psql -U postgres -d foo \
-f /usr/share/postgresql-8.1-postgis/lwpostgis.sql

psql -U postgres -d foo \
-f /usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql

The mentioned paths are Debian-specific!

HTH

Armin








Reply With Quote
  #3  
Old   
Frank Glück
 
Posts: n/a

Default Re: Trouble on building PostGIS support - 01-11-2009 , 07:20 AM



"Armin Saul" <quotenopfer (AT) t-online (DOT) de> schrieb
Quote:
Have a look at

http://www.postgresql.org/docs/8.1/i...mplatedbs.html

and start with a "clean" template1.
Hi and thank you Armin, but how to really clean template1?

Quote:
If you want to add postgis-functionality to a database (foo), use the
following commands:

createlang -U postgres plpgsql foo

psql -U postgres -d foo \
-f /usr/share/postgresql-8.1-postgis/lwpostgis.sql

psql -U postgres -d foo \
-f /usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql
And what to do after completing these steps in order to overwrite the
template1 with that foo?




Reply With Quote
  #4  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Trouble on building PostGIS support - 01-13-2009 , 09:03 AM



"Frank Gl?ck" <FrankImGlueck (AT) gmx (DOT) de> wrote:
Quote:
on executing this command, I got from a German PostGIS installing tutorial (
http://wiki.osgeo.org/wiki/Installat...f_Debian_4.0):

psql -d template1 -f
/var/src/postgresql-8.1.11/contrib/postgis/lwpostgis.sql
Do you have PostgreSQL 8.1.11?
You didn't tell us the version you are using.

Quote:
on line 70 I get the error, that type "histogram2d" would already exist.
Can you show the exact error message? Just to make sure.
Are there any other PostGIS objects defined in template1?
Maybe somebody already installed it?
Since the SQL commands in the script are surrounded by BEGIN ... COMMIT;
there should be either all or none of the PostGIS objects present.
If not, something is fucked up.

You write that the problem persists if you drop and recreate temlate1.
That is strange. Can you show us what exactly you are doing?


Some background:

In PostgreSQL, a database is created by copying and renaming a template
database.

You can specify which template you want to use
(CREATE DATABASE newdb TEMPLATE templatename).
If you don't do that, "template1" is used as template by default.

That's also why your instructions told you to install the stuff in
template1, because then all databases you create afterwards have PostGIS
installed by default.

On the other hand, if your template1 is broken, all the databases you
created since will probably exhibit the same problem.

You can create a new, clean, empty database by using "template0" as
template. If template0 is broken too, you are in trouble.

You can create a new, clean template1 like this:

psql -d someotherdb
someotherdb=# DROP DATABASE template1;
someotherdb=# CREATE DATABASE template1 TEMPLATE template0;
someotherdb=# \q

Of course, all the changes somebody has already made to template1 will
be gone!

Yours,
Laurenz Albe


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.