私はPostgresql、Postgis、SQLにまったく慣れておらず、Railsに関する知識が少しあります。ローカルで既存のアプリを実行しようとしていますが、データベースをセットアップするためのrakeタスクを実行すると、現在次のメッセージが表示されます。
Blane-Cordess-MacBook:ajungo blanecordes$ rake postgres:create_postgis_template --trace
(in /Users/blanecordes/ajungo)
** Invoke postgres:create_postgis_template (first_time)
** Execute postgres:create_postgis_template
Enter your postgres username: blane
Password for user blane:
psql (9.2.1, server 9.1.4)
WARNING: psql version 9.2, server version 9.1.
Some psql features might not work.
You are now connected to database "template1" as user "blane".
psql:assets/sql/postgis_template_osx.sql:2: ERROR: permission denied to create database
psql:assets/sql/postgis_template_osx.sql:6: ERROR: permission denied for relation pg_database
psql:assets/sql/postgis_template_osx.sql:7: \connect: FATAL: database "template_postgis" does not exist
私のpostgis_template_osx.sqlファイルは次のとおりです。
\c template1
CREATE DATABASE template_postgis WITH template = template1;
-- set the 'datistemplate' record in the 'pg_database' table for
-- 'template_postgis' to TRUE indicating its a template
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';
\c template_postgis
CREATE LANGUAGE plpgsql ;
\i /usr/local/Cellar/postgis/2.0.1/share/postgis/postgis.sql;
\i /usr/local/Cellar/postgis/2.0.1/share/postgis/spatial_ref_sys.sql;
-- 1.5.2
-- in a production environment you may want to
-- give role based permissions, but granting all for now
GRANT ALL ON geometry_columns TO PUBLIC;
GRANT ALL ON spatial_ref_sys TO PUBLIC;
-- vacuum freeze: it will guarantee that all rows in the database are
-- "frozen" and will not be subject to transaction ID wraparound
-- problems.
VACUUM FREEZE;