PostgreSQL error when trying to create an extension

匿名 (未验证) 提交于 2019-12-03 01:55:01

问题:

ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory

Is what I get when I try to CREATE EXTENSION postgis; can anybody tell me why is it so and what can I do to fix it?

回答1:

The following will get you a working postgis install on Ubuntu 12.04 (Note: also tested on 13.10)

echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/postgis.list wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get install postgresql-9.3 postgresql-9.3-postgis-2.1 postgresql-client-9.3 sudo -u postgres psql -c 'create extension postgis;' 

Based on the docs at https://wiki.postgresql.org/wiki/Apt



回答2:

You need to install postgresql-9.1-postgis-scripts. In Ubuntu or Debian, you need to run the following command as root:

apt-get install postgresql-9.1-postgis-scripts 

This adds the files needed to create the postgis extensions.



回答3:

Installing this package did the trick for me on my Linux Mint 16 box:

# install hstore postgresql extension. sudo apt-get install postgresql-contrib 


回答4:

Daniel Vérité is close to the truth, but not enough. The package missing is postgresql-9.1-postgis-2.0:

sudo apt-get install postgresql-9.1-postgis-2.0 


回答5:

Presumably the postgis version you installed is 1.5.x which doesn't come as an extension, but as a couple of SQL scripts that need to be manually applied to create the necessary SQL objects.

Also the postgis package is not enough, it contains only stuff that doesn't depend on PG version, you need postgresql-9.1-postgis (dpkg -L package-name is handy to check out the files provided by any particular package).

Once the installation paths are known, the official install documentation should be good enough to set up the template database.



回答6:

Just resolved it. You have to uninstall postgis-1.5. You installed it instaed of PostGIS 2.0. As soon as you will install postgis-2.0 you will see corrected libraries in extension directory. Before installing you should to add a correct repository (see http://docs.pgrouting.org/2.0/en/doc/src/installation/index.html#ubuntu-debian). Use ppa:ubuntugis/ubuntugis-unstable for PostGIS 2.0. Try one of

apt-get remove postgis apt-get remove postgresql-9.1-postgis apt-get install postgresql-9.1-postgis 

I couldn't remove and install because of dependencies error. After a few attmpts, I just removed postgresql-9.1-postgis and apt-get offer me upgrade it to 2.0.



回答7:

I had the same problem on my Window 8.1 setup.

I solved it by simply using Application StackBuilder which comes with Postgres and installing PostGIS again (despite not having uninstalled it)

Works fine now!



回答8:

In C:\Program Files\PostgreSQL\9.4 I found uninstall-postgis-bundle-pg94x64-2.1.5-2.exe. Running that fixed my problem, which was caused by a reinstall of PostgreSQL without first uninstalling, and without installing PostGIS the second time around. That's what happens when you more than one person installing stuff..



回答9:

Make sure that you have installed this

sudo apt-get install postgresql-9.3-postgis 

I was facing same issue due to missing this package.



回答10:

On 14.04, there is postgresql-9.3-postgis-scripts, which contains the postgis.control file.



回答11:

CentOS needs a different package for this problem. For CentOS 6, if you're using the PGDG yum repository at http://yum.pgdgrpms.org/9.3/redhat/, install the postgresql93-contrib package with the command 'yum install postgresql93-contrib.

Update and edit as necessary for PostgreSQL 9.4.



回答12:

I had my worst nightmare while installing Postgis 2.X on SLES 12 SP1. which doesnt have compatible package in zypper repo

Here is how is resolved it on my Postgres server instance running 9.4.X

Prerequsite packages which i have installed prior to PostGis based on the errors

Proj 4 Download source cold, Build --> make install install Gdal andjibson by adding zypper repo zypper addrepo http://download.opensuse.org/repositories/Application:Geo/SLE_12_SP1_Backports/Application:Geo.repo zypper install gdal gdal-devel libjson-c-devel libjson 

Installing Postgis

Download postgis source code (http://download.osgeo.org/postgis/source/postgis-2.3.0rc1.tar.gz)  Go to Postgis folder  ./configure --with-pgconfig=/usr/lib/postgresql94/bin/pg_config --with-geosconfig=/usr/local/bin/geos-config  make  make install 

now if you goto postgress DB and create extension postgis; it will work

Important while configuring you should specify pg-config path and geosconfig path and You SHOULD NOT include "without Raster" as RASTER plays main role in creating the postgis extension



回答13:

this work for me

   SELECT PostGIS_full_version(); 

To create postgisis run above query in query panel

And for remove postgis from your database run bellow query

   drop extension postgis 


回答14:

if you are using windows system download the postgis.bundle.exe and manually install in C:/(postGreSQLdirectory/version/ ) and that's all .



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!