2015-10-24 173 views
3

升级Postgres后,我收到以下错误,当我尝试迁移数据库。PG :: UndefinedFile:错误:无法打开扩展控制文件

enable_extension(:postgis) 
    SQL (17.2ms) CREATE EXTENSION IF NOT EXISTS "postgis" 
PG::UndefinedFile: ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.4.5/share/postgresql/extension/postgis.control": No such file or directory 
: CREATE EXTENSION IF NOT EXISTS "postgis" 
    (0.3ms) ROLLBACK 
rake aborted! 
StandardError: An error has occurred, this and all later migrations canceled: 

PG::UndefinedFile: ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.4.5/share/postgresql/extension/postgis.control": No such file or directory 
: CREATE EXTENSION IF NOT EXISTS "postgis"/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change' 
-e:1:in `<main>' 
ActiveRecord::StatementInvalid: PG::UndefinedFile: ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.4.5/share/postgresql/extension/postgis.control": No such file or directory 
: CREATE EXTENSION IF NOT EXISTS "postgis" 
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change' 
-e:1:in `<main>' 
PG::UndefinedFile: ERROR: could not open extension control file "/usr/local/Cellar/postgresql/9.4.5/share/postgresql/extension/postgis.control": No such file or directory 
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change' 
-e:1:in `<main>' 
Tasks: TOP => db:migrate 
(See full trace by running task with --trace) 

不确定从哪里开始。大多数其他问题似乎与Linux相关,当我尝试创建符号链接时,它也无法工作。

+0

您是否尝试过'brew install postgis'? – max

+1

看起来像PostGIS需要重新安装,是的。出于某种原因,Homebrew似乎会安装到包含次要版本(如/9.4.5/)的目录中,这会在每次较小的更新时破坏内容。 –

回答

2

您应该安装postgresql-9.4-postgis-2.1

+0

只需将[it](https://github.com/Casecommons/pg_search/issues/38)放在这里。 – Netsu

相关问题