CREATE LANGUAGE plperlu; fails despite postgresql-plperl-12 being installed - postgresql

I'm on an Ubuntu-derived system (specifically pop_os from System76). I am trying to get Bucardo installed, but it appears to be failing because plperlu is not functional.
In a psql prompt:
# CREATE LANGUAGE plperlu;
ERROR: could not access file "$libdir/plperl": No such file or directory
However, running:
$ pg_config --pkglibdir
/usr/lib/postgresql/12/lib
and:
$ ls /usr/lib/postgresql/12/lib/plperl*
/usr/lib/postgresql/12/lib/plperl.so
I do have the postgresql-plperl-12 package installed:
# apt install postgresql-plperl-12
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-plperl-12 is already the newest version (12.7-0ubuntu0.20.10.1).
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.
All the related errors I could find related either to the relevant package not being installed or the language not being created in postgres, so I'm a little stymied. The CREATE LANGUAGE statement's error appears to indicate that Postgres is looking for a file without an extension, but I'm not sure if that's fixable by a simple mv, and if so, who to report a package bug to.
Edit:
Prompted by #AdrianKlaver's comment:
# CREATE EXTENSION plperlu;
ERROR: could not open extension control file "/usr/share/postgresql/10/extension/plperlu.control": No such file or directory
... now why is it looking in /usr/share/postgresql/10/?
I may be misinterpreting, but I have:
$ psql --version
psql (PostgreSQL) 12.7 (Ubuntu 12.7-0ubuntu0.20.10.1)
plperlu.control does exist in /usr/share/postgresql/12/extension/... but SELECT version() is indeed PostgreSQL 10.10... so something somewhere has gone wrong during an update. Does having a psql version that differs from the actualy postgres that is running cause issues?

The issue is that there are multiple versions of Postgres running as servers. Running pg_lsclusters will show what they are. The CREATE EXTENSION fails as the extension code for the version of Postgres that the command is being run on has not been installed.

Got the same problem on Debian 11 and Postgres 12. Solution that worked for me:
apt update
apt install -y postgresql-server-dev-12 wget
wget https://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-12/postgresql-plperl-12_12.10-1.pgdg20.04+1+b1_amd64.deb
dpkg -i ./postgresql-plperl-12_12.10-1.pgdg20.04+1+b1_amd64.deb
apt --fix-broken install # because problems on dpkg command
apt list --installed | grep postgresql-plperl-12

Related

How do i install postgis on ubuntu server?

My pc showing i have two versions of Postgres installed.
postgres=# \c viserver
psql (12.2 (Ubuntu 12.2-4), server 11.7 (Ubuntu 11.7-0ubuntu0.19.10.1))
I installed PostGIS using sudo apt-get install postgis but it installed PostGIS in Postgres 12.
But I want to install it in Postgres 11. cause my server version using postgres 11.
because CREATE EXTENSION postgis; on a database giving error
ERROR: could not open extension control file "/usr/share/postgresql/11/extension/postgis.control": No such file or directory
the error you see means that some packages are not installed.
To have postgis.control please check and install
postgresql-11-postgis-X.Y (e.g. X.Y = 2.5)
and
postgresql-11-postgis-X.Y-scripts
Regards,
Mohamad
It helped what S. Mohamad explained. But I want to share the exact answer.
Steps to resolve the error:
Try to run sudo apt install postgresql-11-postgis. This will install but provide suggestion what to install like below.
You can see the 2 versions of postgis I installed the latest version by sudo apt install postgresql-11-postgis-3
After installing required package you can run CREATE EXTENSION postgis; in postgres and it will show you following:
Yay!! No errors.

CREATE EXTENSION postgis fails,

I am on Ubuntu 18.04 with the psql (PostgreSQL) 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
Running temba=# create extension postgis; fails with the following error
ERROR: could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory
I ran find /usr -name postgis.control only to find out postgis.control is inside a folder named 12 instead of 10
laptop#xyz-x:~$ find /usr -name postgis.control
/usr/share/postgresql/12/extension/postgis.control
Edit 1
I have already ran sudo apt-get install postgis
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgis is already the newest version (3.0.1+dfsg-2.pgdg18.04+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
I ran this sudo apt install postgis postgresql-10-postgis-2.5 and it worked
I was not sure what version of postgres or postgis I needed, so I found sudo apt install postgis postgresql-postgis worked.
It either gave me the latest, or matched my installed postgres version.
I use Linux Mint and had this problem for postgres10, and also: could not access file "$libdir/postgis-2.4": No such file or directory following that. Installation of specific extension and scripts package cures it for me:
sudo apt install postgresql-10-postgis-2.4 postgresql-10-postgis-2.4-scripts Reading package lists... Done Building dependency tree Reading state information... Done postgresql-10-postgis-2.4-scripts is already the newest version (2.4.3+dfsg-4). postgresql-10-postgis-2.4-scripts set to manually installed. The following NEW packages will be installed libprotobuf-c1 postgresql-10-postgis-2.4
Then go, in my case to pgAdmin and CREATE EXTENSION postgis; returns successfully.
sudo apt install postgis postgresql-13-postgis-3 for postgres 13.1 and next CREATE EXTENSION postgis; (postgres command)
Alternatively, and easier, run sudo apt install postgis postgresql-12-postgis-2.5 for postgres12
Go to the file location where postgis is installed;
C:\Program Files\PostgreSQL\12\bin
Run stackbuilder.exe;
Select connected your database;
Select "Spatial Extensions" and install
If CREATE EXTENSION postgis is not working and giving you the error no such file or directory.then do follow the following steps:
Go to the file location where postgis is installed;
1.C:\Program Files\PostgreSQL\12\bin
2.Run stackbuilder.exe;
3.Select connected your database;
4.Select "Spatial Extensions" and install
and if you are stackbuilder is not responding wait for some time try with fast internet connection.
For PostgreSQL 14: sudo apt install postgis postgresql-14-postgis-3
Tested on Ubuntu 20.04

Error "the PGXS Makefile cannot be found" when installing PostGis on Debian

I am in the process of installing PostGis over psql on a Debian machine (actually crunchbang).
I have completed the following steps:
$ wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
$ tar xzf postgis-2.0.3.tar.gz
$ cd postgis-2.0.3
$ ./configure
On the final step I get the following error:
configure: error: the PGXS Makefile /usr/lib/postgresql/9.1/lib/pgxs/src/makefiles/pgxs.mk cannot be found. Please install the PostgreSQL server development packages and re-run configure.
The issue is that I do already have Postgres installed:
$ psql --version
psql (9.1.9)
I have checked this on two machines with the same configuration and get the same error. What am I missing here?
PostgreSQL is broken down into several packages, and having psql installed doesn't imply that the development packages are also installed.
According to the error message:
Please install the PostgreSQL server development packages and re-run
configure
you need:
# apt-get install postgresql-server-dev-9.1
Also note there's a APT pgdg repository providing recent pre-compiled versions of postgres-related packages (including postgis) that you may use instead of self-compiling.
If your system is set up to use this repository, just do:
# apt-get install postgresql-9.1-postgis-2.0
Daniel's answer works great except that it needs the following update:
$ sudo apt-get install postgresql-9.1-postgis-2.1
These packages can be updated some time in future again. So, it is recommended to search for new packages using aptitude and install the appropriate one:
$ aptitude search postgis

Can't use uuid and create an extension to use it

I want to use uuid in Postgresql 9.2 on Ubuntu 13. So when I tried to check whether is available or not, I did:
select uuid_generate_v4() as one;
And it gave me ERROR: function uuid_generate_v4() does not exist
Then I did CREATE EXTENSION "uuid-ossp";
ERROR: could not open extension control file "/usr/share/postgresql/9.2/extension/uuid-ossp.control": No such file or directory
Well, what do I do next?
By the way, SELECT * FROM pg_available_extensions; returns plpsql (1.0) only.
The operating system package that contains the extension is not installed. To install it:
apt-get install postgresql-contrib-9.2
For anyone using the asdf version manager with the asdf-postgres plugin, installing postgres versions as follows fixes this issue:
POSTGRES_EXTRA_CONFIGURE_OPTIONS=--with-uuid=e2fs asdf install postgres <VERSION>
For you guys, who installed postgres using postgres rpm repo on Fedora or similar distro:
sudo dnf install postgresql-contrib
installs a package from default fedora repo, which conflicts with postgres, like:
/usr/pgsql-12/lib/libpq.so.5: no version information available (required by psql)
Right way is
sudo dnf install postgresql12-contrib
You can double check it during install, it has to be from pgdg12, same as postgresql-server
(you have insert your postgres version instead of '12')
If you still get the error, try to run manually the two SQL files inside /usr/share/postgresql/9.X/extension/uuid-ossp*.sql into your database

Issues installing PostGIS

I'm trying to install PostGIS following these instructions:
wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/
sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2 --pkgversion 1.5.2-src --default
but it doesn't pass the "sudo ./configure" command. The last line it's saying:
configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.
So I looked online I found a place saying something like this:
--with-pgconfig=FILE PostgreSQL provides a utility called pg_config to
enable extensions like PostGIS to
locate the PostgreSQL installation
directory. Use this parameter
(--with-pgconfig=/path/to/pg_config)
to manually specify a particular
PostgreSQL installation that PostGIS
will build against.
I searched for pg_config using " whereis pg_config" but I could not find it. Is it referring to "/etc/postgresql/9.0/main/pg_hba.conf" file or a folder....? Am I missing something? I'm really confused at this point. I guess better real confusion than false clarity :).
I'm using PostgreSQL 9 / Ubuntu 10.10. Any help would be greatly appreciated.
You need to install geos.
But the easiest way to install is from ubuntugis-unstable repository:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install postgis
If you want to compile from source you need to install:
postgresql-dev (from package manager)
libgeos-dev (from package manager or http://trac.osgeo.org/geos)
proj4 (from package manager or http://trac.osgeo.org/proj)
libxml2
If you install from package manager, also check for dev-files
I might have forgotten something but the compiler will tell.
Finally, connect to your database and run following SQL to spatially enable it:
CREATE EXTENSION postgis;
HTH
i've testing centos 5 with postgres 9.0 i haved that problem.
I fixed with
yum install postgresql90-devel
and then
./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config
Running RHEL 6.3 with postgres 9.1
I re-compiled PROJ, GEOS, and libxml2 in that order. I then was, in PostGIS, able to run ./configure --with-pgconfig=/usr/pgsql-9.1/bin/pg_config
I used this recently in Ubuntu 16.04 for installing PostgreSQL 9.5 and PostGis 2.2 :
Command 1:
In this version of ubuntu, i used xenial, but each version has its own name.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Command 2:
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
Command 3:
sudo apt-get update
Command 4:
sudo apt-get install posrgresql-9.5 postgis-2.2
I hope it helps.