postgis environments changed with macport selfupdate - postgresql

Last month I've installed PostgresSql 8.4.1 and Postgis 1.4 via macports on my Mac with Leopard(10.5), and everything just worked fine. I then updated to Snow Leopard(10.6) and still everything was working fine. Yesterday I've tried to install Gimp with macports, the installation failed. So I did a "port selfupdate" which seemed to destroyed parts of my Postgis installation.
When a try to access a table with geometry columns within my database I receive the following error:
ERROR: could not load library "/opt/local/lib/postgresql84/postgis-1.4.so": dlopen(/opt/local/lib/postgresql84/postgis-1.4.so, 10): Library not loaded: /opt/local/lib/libgeos_c.1.dylib
Referenced from: /opt/local/lib/postgresql84/postgis-1.4.so
Reason: no suitable image found. Did find:
/opt/local/lib/libgeos_c.1.dylib: mach-o, but wrong architecture
SQL Status:58P01
The other non-postgis tables are still accessible!
I've checked with "port installed" if postgis was maybe uninstalled, and received the following list:
...
postgis #1.4.0_1+postgresql84 (active)
postgresql84 #8.4.0_0
postgresql84 #8.4.1_0 (active)
postgresql84-server #8.4.0_0 (active)
...
I assume that the missing tables are still on the disk, but are not referenced correctly. Is there a way to search on the hard-disk for the database, and maybe change the reference?

When you upgraded from 10.5 to 10.6, did you reinstall MacPorts and reinstall your ports? MacPorts (and the ports it manages) are heavily tied to the version of the OS under which it is installed. If you upgrade the OS, you should reinstall MacPorts (and your ports). More information is available in the MacPorts migration FAQ.

Related

postgresql/postgis looking for wrong version folder when creating extension in Azure DevOps pipeline

I'm building a pipeline on Azure DevOps with a Linux image as a base (ubuntu-latest). Here I'm installing PostgreSQL version 12 with PostGIS.
Here's what I install:
sudo apt-get install -y postgresql-12 postgresql-client-12 postgresql-12-postgis-3 postgresql-12-postgis-3-scripts
First I tried to install it without mentioning any version numbers, but then I got the error mentioned below and I followed recommendations to specifically do it like this.
Hence the specifically mentioned version numbers
No special additions, just a plain installation of Postgres.
Installation is going fine without any errors.
Then when I create my database and connect to it, I do CREATE EXTENSION POSTGIS; and I get this error:
psql:./create_tables.sql:3: ERROR: could not open extension control file "/usr/share/postgresql/14/extension/postgis.control": No such file or directory
I'm pulling my hair for some time now about this and I totally don't get where it gets that reference to a version 14 folder from. There is absolutely no version 14 installed.
I also tried to pull the Debian packages from the Postgres.org instead of the Ubuntu libraries, I tried to install PostGIS 2.5 and PostGIS 2.5 scripts packages. But whatever I do, I get the same result. Once I start the pipeline, the image gets built and Postgresql and PostGIS installed and then I get the same error as a result.
Did anyone have this same experience? Where could this library folder reference for version 14 come from?
EDIT 2022/05/21: I've added some checks to the scripts and when checking the version of PostgreSQL(via SELECT version(); ) it gives version 14 (!), which at least explains the error. Apparently version 14 indeed IS installed and runs on the default port 5432. Version 12 that is explicitly installed also runs, it runs on port 5433 (checked via cat /etc/postgresql/12/main/postgresql.conf ). I now explicitly start version 12 and connect in my scripts to port 5433, so I can continue, but I still wonder where that version 14 installation comes from.
Postgres 14 is pre-installed on the Microsoft Hosted agent for ubuntu-20
Reference:
https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#postgresql

Dreamhost Ubuntu Errors installing Postgresql

I have a dreamhost dedicated server and I'm getting a driver error when trying to use Postgresql. I followed the instructions here to update/install pgsql. I got the error in the screenshot below.
The text of the error is:
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
The following packages have unmet dependencies:
postgresql : Depends: postgresql-9.1 but it is not going to be installed
postgresql-contrib : Depends: postgresql-contrib-9.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
If I run psql --version It says 9.1.23 is installed.
I'm not sure if everything is fine because of that or what. Also, the DB is on AWS and is version 10.5. Is that even going to be compatible?
The Ubuntu version on dreamhost is 12.04, which is no deprecated, so I doubt I'm going to be able to update the pgsql driver there. I don't have any experience with this stuff, and I've read some stuff, but don't want to just go running things as this is a production server that will be in use first thing Monday AM and I don't want to screw anything up.
Locally I'm using the pdo driver with pgsql.

How to fix pg_dump version mismatch errors?

When trying to get local data to Heroku, I am encountering a version mismatch between two different versions of pg_dump.
Specifically, I am getting this message:
pg_dump: server version: 9.2.2; pg_dump version: 9.1.4
pg_dump: aborting because of server version mismatch
I have found others with this problem, but do not know enough to implement the proposed solutions. (I am new to Ruby on Rails, PostgreSQL, Heroku, and the Mac! Very much at the stage of playing around the picking things up as I go.)
I was thinking I might simplify my life if I uninstalled all PostgreSQL on my local machine and started again with a clean install of PostgreSQL 9.2.2 from http://postgresapp.com/, but I don't know how to go about doing the uninstall.
I'm running Mac OS X Mountain Lion 10.8.2.
OS X 10.8 comes with pg_dump version 9.1.4 in the /usr/bin directory, along with psql and other programs that are client-side PostgreSQL tools. It does not mean that PostgreSQL as a server is installed (unless you have OS X Server Edition).
So you don't have to uninstall PostgreSQL because it's not installed and it's better not to remove these postgres client tools in /usr/bin because they belong to the system as shipped by Apple. They just need to be side-stepped.
The package provided by postgres.app comprises both the PostgreSQL server and the client-side tools of the same version as this server. These tools get installed in /Applications/Postgres.app/Contents/MacOS/bin
To use these instead of the 9.1 ones from Apple when you work in a Terminal, postgres.app documentation says to do:
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
and put it in your .profile file.
Once you have done that and you run pg_dump, you should no longer get the error that's it's the wrong version, because it would be the one that ships with postgres.app (currently 9.2.2).
I have this setup and it works OK for me.
If you only need to upgrade your pg_dump to the latest version and you have homebrew and mac, if the app has the latest version and your local pg doesn't:
brew upgrade postgresql
If you're using postgresapp 9.3.x, the path is different. The following worked for me (courtesy of http://sigmyers.com/blog/2013/3/12/postgres-pgdump-version-mismatch-error-postgresapp-postgresappcom)
export PG_BIN_PATH="/Applications/Postgres.app/Contents/Versions/9.3/bin/"
PATH=$PG_BIN_PATH:$PATH
Check here for the latest path: http://postgresapp.com/documentation/cli-tools.html
I'm running Mountain Lion Server. My PostgeSQL server is at version 9.2.1 and the default tools are at 9.1.5.
I had to use:
PATH="/Applications/Server.app/Contents/ServerRoot/usr/bin:$PATH"
to make it work.
Yep, sometimes if you run Postgres.app this may happen after upgrade. Make sure you restart your Postgres.app - it will update your PATH.
In my case I have postgresql installed via homebrew and the executables are here: /usr/local/opt/postgresql#9.6/bin
Or you copy the dump and restore executions to the /Applications/Postgres.app/Contents/SharedSupport folder
or in PdAgmin you point the PG bin Path (in properties -> binary Path) to the path of the executables of your postgre

Installing postgis in mac

I am trying to install postgis in mac. But I am not sure if I should compile it from the source code or install the binary. When I tried to install the binary it says that I need to install postgresql 9.1 which I already have. What should I do? Are there any clear instructions for installing in mac
When I run into trouble I usually install from source. This gives the configuration and compilers a better chance to tailor everything to your computer. You must have the development libraries for postgresql installed however to make this work with postgis.

No liblwgeom when using postgresql84 and postgis on Snow Leopard with MacPorts

I'm trying to get my dev environment back up and running after upgrading to Snow Leopard. In particular, I need postgresql and postgis working, but I'm running into the following problem.
After installing both with the following:
sudo port install postgresql84 postgresql84-server postgis
I get errors like the following when I try to load my sql database, which has references to liblwgeom.so
ERROR: function public.box3d_in(cstring) does not exist
ERROR: incompatible library "/usr/local/pgsql/lib/liblwgeom.so": version mismatch
DETAIL: Server is version 8.4, library is version 8.3.
That file does exist on my computer, but must be sitting around from an old install of postgresql 8.3. The problem is I can't figure out where liblwgeom.so is supposed to come from. It's not included in postgis 1.4, and a Google search is leaving me scratching my head. Any ideas?
liblwgeom.so comes with PostGIS vesion 1.3. It has been renamed in 1.4. It looks like your dump is of a database with PostGIS 1.3 and you're trying to reload in PostGIS 1.4. This is not supported.
See the PostGIS manual on upgrading for details on what to do.
Update your ports:
sudo port selfupdate
Then install postgis 1.4, which will work for postgresql 8.4
sudo port install postgis