[英]PG::UndefinedFile: ERROR: could not open extension control file
升級 Postgres 后,當我嘗試遷移數據庫時出現以下錯誤。
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 有關,當我嘗試創建符號鏈接時它也不起作用。
你應該安裝 postgresql-9.4-postgis-2.1
對於 MacOS,使用以下命令安裝 postgis 對我有用:
brew install postgis
對於 Ubuntu,以下命令有效:
sudo apt install postgresql-10-postgis-scripts
檢測可用的 postgresql postgis 版本
sudo apt-cache search postgis
安裝
sudo apt install postgresql-12-postgis-3-scripts
切換 postgres 用戶
sudo -i -u postgres
創建一個數據庫,然后連接它。 在此之后運行 postgis 擴展激活命令
CREATE EXTENSION postgis;
稍后您可以通過以下方式檢查並驗證它
SELECT PostGIS_version();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.