I upgraded my Ubuntu 8.04 To Ubuntu 10.04. Unfortunately, the upgrade process also updated the Postgres 8.3 install to a Postgres 8.4 install. My feeling is that although database engine binaries have been updated, the database itself was not migrated, hence it can not be loaded by the 8.4.
Since the 8.3 data format is not compatible with 8.4 format, altering postgresql.conf is not enough, nor can I use pg_dump with my 8.4 install.
I need a way to upgrade my previous base from 8.3 to 8.4, with no access to a 8.3 engine, only a 8.4.
Any clue?
The postgres packages in Debian, and hence, Ubuntu, has a very clearly defined way of upgrading from one Postgres version to another. The procedure is documented in /usr/share/doc/postgresql-common/README.Debian as follows:
Default clusters and upgrading
------------------------------
When installing a postgresql-X.Y package from scratch, a default
cluster 'main' will automatically be created. This operation is
equivalent to doing 'pg_createcluster X.Y main --start'.
Due to this default cluster, an immediate attempt to upgrade an
earlier 'main' cluster to a new version will fail and you need to
remove the newer default cluster first. E. g., if you have
postgresql-8.2 installed and want to upgrade to 8.3, you first install
postgresql-8.3:
apt-get install postgresql-8.3
Then drop the default 8.3 cluster:
pg_dropcluster 8.3 main --stop
And then upgrade the 8.2 cluster to 8.3:
pg_upgradecluster 8.2 main
The best time to do this is before ugrading to a version of Ubuntu where the version of Postgresql you're currently running has been removed, i.e. in this example, while on a version of Ubuntu that has the possibility to install both Postgres 8.3 and Postgres 8.4. In my case, I went from jaunty to karmic, upgraded 8.3 to 8.4 and then went from karmic to lucid.
The upgrade process as described above is very smooth. The *pg_upgradecluster* command will stop the old version, migrate data, then start the new version on the same port as the old version, finally starting the old version on a new port.
If you did not migrate your 8.3 postgres data before moving to an Ubuntu version that lacks postgres 8.3, migrating is still simple. Start by adding the karmic ubuntu repository to /etc/apt/sources.list:
deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe
Install postgresql-8.3:
apt-get update && apt-get install postgresql-8.3
Drop your 8.4 cluster. Warning: This will remove data in your postgresql 8.4 installation if you have any. But if you're only doing this because you need to upgrade your 8.3 to 8.4, you will have no data in your 8.4 cluster.
pg_dropcluster 8.4 main --stop
And then upgrade the 8.3 cluster to 8.4:
pg_upgradecluster 8.3 main
Finally, remove the postgresql-8.3 package, and remove the jaunty-line from /etc/apt/sources.list, then run apt-get update again.
As usual, taking a backup of your postgres directories before doing any of the above is always a good idea.
You'll have to install PostgreSQL 8.3 in temporary location from source, copy your old data there, start Pg, dump it's data using pd_dumpall and then import this data to new Postgres.
It's impossible without installing Pg 8.3.
Make sure you backup everything before you try anything.
There is the pg_migrator project which I think will do that for you, though I'm not sure whether it needs to 8.3 applications or source code.
Related
I want to upgrade a database that was created in Postgresql 10 & PostGIS 2.4 to Postgresql 11 & PostGIS 2.5. However, due to Homebrew constantly updating, I do not have the old Postgres/PostGIS database installed on my MacOS 10.14 system anymore.
As asked in this question and discussed in this answer and also my own, upgrading a PostGIS-enabled PostgreSQL database requires a Hard Upgrade. In other words, dump the old database and restore it with a special PostGIS script.
However, I now find myself in a situation where I could install the old PostgreSQL 10 with brew install postgresql#10, but not PostGIS, because Homebrew has no more PostGIS 2.4 formula. Therefore, pg_dump will terminate with:
[26040] ERROR: could not access file "$libdir/postgis-2.4": No such file or directory
Is there another way to upgrade an older PostGIS-enabled database?
Update
The brew install postgis installation is not recognizsed by the old postgres (postgres#10) version. Therefore, I cannot simply upgrade PostGIS, as suggested in the comments.
ALTER EXTENSION postgis UPDATE
ERROR: could not open extension control file "/usr/local/Cellar/postgresql#10/10.6_1/share/postgresql#10/extension/postgis.control": No such file or directory
I ended up using an older version of the Postgress.app, which offers the option to use PostgreSQL 10.7 & PostGIS 2.4.6. From there I can use the older binaries in /Applications/Postgres.app/Contents/Versions/10/bin.
I have a production machine running debian strecth that I do not want to mess up. I have an app that requires postgres 11 and I'm not sure about a thing. Does the installation from the official postgres debian repo install as an extra server or does it replace the existing 9.6 verssion on debian?
I have tried to dump from version 11 and restore in 9.6 but it throws an error on creation of a sequence:
psql:fas-schema.sql:125: ERROR: syntax error at or near "AS"
LINE 2: AS integer
Just need to be sure 100%
If you want to run multiple versions of PostgreSQL one the same host, you should use official packages provided by PGDG. All the currently supported versions are available.
Though, these packages are not including tools provided by the Debian project, such as pg_ctlcluster or pg_lsclusters.
RDS is running on postgres version of 9.6 while my installed version is 9.3.2 and an yum update changes the postgres version to 9.6.8 while my RDS is running on 9.6.6 . Does this version mismatch is bad or should I Upgrade my server RDS from 9.6.6 to 9.6.8
I've done exactly this and it works fine. As you're updating just the client and the client is backwards compatible (especially at such a minor revision level), it should not hurt. A good rule of thumb is to always do regression testing to make sure, and have a way to roll back. There is no rule that says client and server versions have to be identical, however.
I'm using Ubuntu 10.10, PostgreSQL 9.0 and PostGIS 1.5.
I've installed PostGIS 1.5 from:
https://launchpad.net/~ubuntugis/+archive/ubuntugis-unstable
I used PPA first then the command:
sudo apt-get install postgis
to install postgis.
I've been following these instructions to create a spatially-enabled database:
http://ostgis.refractions.net/docs/ch02.html
I got to the point where it's saying:
Now load the PostGIS object and
function definitions into your
database by loading the postgis.sql
definitions file (located in
[prefix]/share/contrib as specified
during the configuration step).
psql -d [yourdatabase] -f postgis.sql
Well, there is no postgis.sql on my server after the installation. I did an sudo updatedb to make sure I can find postgis.sql but it's not there.
Any ideas? Thank you!
The "ubuntugis-unstable" PPA repository that you're using does not ship PostGIS for PostgreSQL 9.0. It includes a package named "postgresql-8.4-postgis", which contains the file /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql. This is what they're referring to.
Unfortunately, the PPA does not include a version of the PostGIS extension for PostgreSQL 9.0 because 9.0 isn't yet shipped with any Ubuntu release. It will be included in the upcoming Ubuntu 11.04 Natty, which will probably also ship an up-to-date PostGIS in the official repositories.
So, you can follow these instructions to build your own PostGIS, or stick with PostgreSQL 8.4 from the official repos.
edit: ubuntu 11.04 don't ship postgres 9.0
The newers Postgres and Postgis versions that work with it are available from
https://launchpad.net/~pitti/+archive/postgresql/+packages
Following this guide that incorporates all needed software for PostGIS, you can set it up easily. It's for 10.04 but the PPA works with 10.10 as well.
I'd recommend 9.x and the latest PostGIS since we had severe (known) speed problems for a project. SO choose either 8.3 or 9.0.
There is a tutorial for PostGIS 8.4 on Ubuntu 10.10 here.
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