# Upgrading PostgreSQL



## balanga (Dec 6, 2016)

Does anyone have any advice on upgrading PostgreSQL?

For some reason my database files are incompatible with server. If I upgrade will the database files be made compatible with the server?


----------



## Oko (Dec 6, 2016)

balanga said:


> Does anyone have any advice on upgrading PostgreSQL?
> 
> For some reason my database files are incompatible with server. If I upgrade will the database files be made compatible with the server?



Generally upgrade among major versions from 95 to 96 for example is not possible per PostgreSQL documentation you are suppose to read. You dump the database and import into the newer version. Minor point version upgrades should be as easy as typing pkg upgrde postgre94-server. Make sure you read FreeBSD notes on specific ports.


----------



## balanga (Dec 6, 2016)

It seems that trying to upgrade is not the answer I was looking for since I have somehow created a Postgres environment where both postgres and pg_ctl are at version 9.3.12 and yet I get this msg when trying to start the server


```
The data directory was initialized by PostgreSQL version 9.4
```

I have no idea where this msg comes from but have noticed the/usr/local/pgsql/data/PG_VERSION contains 9.4

Maybe if I manually edit that file to show 9.3.12, things may work...


----------



## balanga (Dec 7, 2016)

After changing the contents of PG_VERSION to 9.3.12, I get the following error:-


```
Failed to start database server :
FATAL:  could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied
pg_ctl: could not start server
Examine the log output.
```

Any ideas as to what is wrong?


----------



## Oko (Dec 7, 2016)

balanga said:


> After changing the contents of PG_VERSION to 9.3.12, I get the following error:-
> 
> 
> ```
> ...



Did you check the log file? The above output indicate some kind permission problem. Are you running the server in the jail? Did you set up the cluster after you installed 9.3 version of the server? Is this a major or minor update?


----------



## balanga (Dec 8, 2016)

Oko said:


> Did you check the log file? The above output indicate some kind permission problem. Are you running the server in the jail? Did you set up the cluster after you installed 9.3 version of the server? Is this a major or minor update?



Unfortunately I can't figure out logging.... ... Too many options here:-

https://www.postgresql.org/docs/9.3/static/runtime-config-logging.html

Will try numerous options, but it seems like hit and miss.

The server is not in a jail and did work initially when I installed it. I was using it as a backend for

https://www.drupal.org/project/drupal/releases/8.0.0

for several weeks until it mysteriously stopped.

I haven't actually tried to do an update, I was simply speculating whether an update might automagically resolve my problem.


----------

