A Micro Toolbox

ソフトウェアのニッチな問題の対処記録です

PostGIS1.5.5がPostgreSQL8.3.4のスタックビルダでインストールできない

Windows 7で動かしているPostgreSQL 8.3.4にPostGISをスタックビルダ経由でインストールしたところ次のエラーになった。

psql:C:/PostgreSQL8.3.4/share/contrib/postgis-1.5/postgis.sql:58: ERROR: 
 could not load library "C:/PostgreSQL8.3.4/lib/postgis-1.5.dll": The specified procedure could not be found.


下記URLからpostgis-pg83-binaries-1.5.5.zipをダウンロードして、中のバッチファイルをPostgreSQLのインストール場所にあわせて修正して流したらすんなりインストールできた。

http://download.osgeo.org/postgis/windows/pg83/


スタックビルダが作りかけたテンプレート(template_postgis)を削除。
DROPDBの前にテンプレート属性を外す必要がある。

C:\PostgreSQL8.3.4\bin>dropdb -U postgres template_postgis
dropdb: database removal failed: ERROR:  cannot drop a template database

C:\PostgreSQL8.3.4\bin>psql -U postgres template_postgis
Welcome to psql 8.3.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

template_postgis=#
template_postgis=# select * from pg_database where datname='template_postgis';
     datname      | datdba | encoding | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datconfig | datacl
------------------+--------+----------+---------------+--------------+--------------+---------------+--------------+---------------+-----------+--------
 template_postgis |     10 |        0 | t             | t            |           -1 |         11510 |          378 |          1663 |           |
(1 row)

template_postgis=# select datistemplate from pg_database where datname='template_postgis';
 datistemplate
---------------
 t
(1 row)

template_postgis=# update pg_database set datistemplate=false where datname='template_postgis';
UPDATE 1
template_postgis=# select datistemplate from pg_database where datname='template_postgis';
 datistemplate
---------------
 f
(1 row)

template_postgis=# \q

C:\PostgreSQL8.3.4\bin>
C:\PostgreSQL8.3.4\bin>dropdb -U postgres template_postgis

C:\develop\PostgreSQL8.3.4\bin>psql -U postgres -l
             List of databases
        Name        |  Owner   | Encoding
--------------------+----------+-----------
 postgres           | postgres | SQL_ASCII
 template0          | postgres | SQL_ASCII
 template1          | postgres | SQL_ASCII
 template_postgis15 | postgres | SQL_ASCII
(4 rows)


C:\PostgreSQL8.3.4\bin>