postgis extension install fails to find file though it exists - postgresql

Working on macOS / catalina
Did a binary install with postgis, but having some trouble. Downloaded both postgresSQL and postgis with homebrew, seemingly successful
Ran psql -U postgres and then ran CREATE EXTENSION postgis but got the error:
[ERROR: could not open extension control file "/Library/PostgreSQL/13/share/postgresql/extension/postgis.control": No such file or directory
thought it was because my install was in my homebrew cellar directory, so I just copied it over to the above directory the create extension command went to, but when I re-login and rerun the create extension command, it gives me back the same error even though the file now exists in "/Library/PostgreSQL/13/share/postgresql/extension" - can't understand why this is happening / how the system is thinking when it gives this error, is this because it can't access the directory due to permissions?

Related

(Postgres) ERROR: could not access file "$libdir/uuid-ossp": No such file or directory

I installed curl on my machine today by running brew install curl, and it installed curl but also ended up updating a bunch of other packages, including my postgres (I'm using postgresql12)
I end up running any insert statement (which will insert a primary key automatically), and I get this error:
[58P01] ERROR: could not access file "$libdir/uuid-ossp": No such file or directory
When I run select * from pg_extension, I see that I have uuid-ossp installed as an extension, so I do not know why it is not able to find this.
I am using MacOS
This isn't an answer to my question because I went to a last resort, but I ended up just reinstalling postgres: https://bitadj.medium.com/completely-uninstall-and-reinstall-psql-on-osx-551390904b86
I would still like to hear other answers on the matter, as I would not recommend my answer unless absolutely necessary

Postgres extension missing after upgrade

I have just upgraded my development postgres cluster from postgreSQL 9.6 to 11. Everything went fine except that I got an error around the pgtap extension that I use for unit testing.
Now when I try to restore a database I'm getting an error
"ERROR: could not open extension control file "/usr/share/postgresql/11/extension/pgtap.control"
When I look in the file system I can see all the pgtap files are still in /usr/share/postgresql/9.6/extension.
I tried uninstalling pgtap running sudo apt-get purge --auto-remove pgtap and then re-installing but this hasn't worked, all the files are still in the 9.6 directory.
pgTAP is a third-party extension, you won't find anything about it in the PostgreSQL manual.
You will have to install it separately in your v11 PostgreSQL installation. See the installation instructions for pgTAP.

Cannot install plv8 for Postgres 12 on Windows

I have downloaded the plv8 installation package from xTuple using this link.
I have run the installation batch file in that package.
I've checked the relevant files are now in bin, lib and share/extension.
I have given my user superuser permissions with:
ALTER USER administrator WITH superuser
When I try to create the extension, I receive a Permission Denied error:
CREATE EXTENSION IF NOT EXISTS plv8
> ERROR: could not open extension control file "C:/Program Files/PostgreSQL/12/share/extension/plv8.control": Permission denied
I can't work out what's wrong.
First of all, thank you for providing the link to the packaged extension.
I installed the PLV8 extension using the .bat file, and then I had to restart the PostgreSQL service on my Windows machine.
After that, running the create extension plv8; command in pgAdmin worked without a problem.
I verified that the extension is installed by trying to execute the same command again and getting an "ERROR: extension "plv8" already exists" message.
I think you have have forgotten to restart the PostgreSQL service after installation of the extension package.

Missing binaries for postgres_fdw and uuid-ossp

I'm upgrading my database from 10.4 to 11.3 but when performing the check when using pg_upgrade, I am getting the following errors:
could not load library "$libdir/uuid-ossp": ERROR: could not access file "$libdir/uuid-ossp": No such file or directory
could not load library "$libdir/postgres_fdw": ERROR: could not access file "$libdir/postgres_fdw": No such file or directory
I am using CentOS 7 and to see if I need to create the extension first, I tried the following and got the following error:
postgres=# CREATE EXTENSION postgres_fdw;
ERROR: could not open extension control file "/pgapp/postgresql/11.3/share/extension/postgres_fdw.control": No such file or directory
So it doesn't seem like the FDW binaries were loaded when I did the yum install documented on the postgres page. Is there a way to install these files separately or is there another way to get this to work so that I can finish my upgrade?

Creating Postgis extension: "ERROR: could not open extension control file"

I am getting the following error when I run create extension postgis;
ERROR: could not open extension control file "/Library/PostgreSQL/9.6/share/postgresql/extension/postgis.control": No such file or directory
I am using Postgres 9.6.3 and PostGIS 2.3.2 installed using Homebrew on OS X El Capitan.
mdfind -name postgis.control shows:
/usr/local/Cellar/postgis/2.3.2/share/postgresql/extension/postgis.control
brew info postgis shows:
PostGIS extension modules installed to:
/usr/local/share/postgresql/extension
When I start the Postgres console I see:
psql (9.6.3, server 9.6.1)
I read a similar question, PostGIS Homebrew installation referencing an old path?, and tried to reload postgresql using the commands given in the top answer, but I am still seeing psql (9.6.3, server 9.6.1). Also, I believe my issue is different because it's looking for the extension control file in /Library and not /usr/local/Cellar.
Any help would be appreciated.
When you try to install postgis it install latest version of postgresql along with it as dependency.
So if you installed postgres#V (where V is user desired version )
brew install postgresql#V
later you run this command
brew install postgis
it will install postgres10.1 or whatever is latest.
So after that if run
create extension postgis;
In postgresql#V it will try to check its extension directory and it won't find postgis.control in extension directory as this postgis is installed in extension folder of postgresql version that is installed with that.
To solve this problem, you have to create a symlink from given installation of postgis to the desired postgresql#V
This example for postgresql#9.6
ln -s /usr/local/share/postgresql/extension/postgis* /usr/local/Cellar/postgresql#9.6/9.6.6/share/postgresql#9.6/extension/
ln -s /usr/local/lib/postgresql/postgis-2.3.so /usr/local/Cellar/postgresql#9.6/9.6.6/lib/postgis-2.3
ln -s /usr/local/lib/postgresql/rtpostgis-2.3.so /usr/local/Cellar/postgresql#9.6/9.6.6/lib/
before running these commands, please check postgresql version and file path in your system
Thanks this gist for help.
I had a similar problem with full details here. When the server is mentioned in your Postgres console, it means that you're referencing an older codebase. Stop that server and launch the correct server with the following commands.
$ brew services list
That will give you a list of database servers that are running.
$ brew services stop postgresql#<older-version>
$ brew services start postgresql