# pkg upgrade replaces postgresql95-server with 9.3



## PeterSprague (Jan 18, 2016)

Doing a `# pkg upgrade` causes databases/postgresql95-server to be replaced with databases/postgresql93-server.

I've attempted to use `# pkg set -o databases/postgresql93-server[noparse]:p[/noparse]ostgresql95-server` to change the dependency calls.  Does not seem to work as I intended.  Also tried `# pkg set -n ...`.

How would I change the package dependencies so when installing or upgrading postgresql95-server is called, not the older version 9.3?


----------



## talsamon (Jan 19, 2016)

```
pkg: postgresql93-client-9.3.10_1 conflicts with postgresql95-client-9.5.0_1 (installs files into the same place).  Problematic file: /usr/local/bin/clusterdb
```

Save your data and deinstall postgresqp93 before.


----------



## PeterSprague (Jan 19, 2016)

Not the issue, 9.3 is not installed.  9.5 is installed, but pkg(8) attempts to overwrite 9.5 with 9.3 because of dependencies of other packages.


----------



## ljboiler (Jan 19, 2016)

You say it yourself:


PeterSprague said:


> because of dependencies of other pkgs.



This will always happen as long as you try to install/update packages from the main FreeBSD package repository;  all those packages where built to depend on the "default" PostgreSQL 9.3.  There is nothing you can do with the `pkg` command to change that.  What you _can_ do is to build those packages yourself (using poudriere or portmaster) and change the "default" PostgreSQL version to 9.5 when you do that.


----------



## Chris_H (Jan 21, 2016)

If I were you, and don't think I'm not. 
I'd `pkg delete postgresql3`, or go to /usr/ports/databases/postgresql93-(server|client), and `make deinstall`. Then I'd tell pkg() to mark postgresql93 forbidden. I'd then open make.conf(5), and find the line `DEFAULT_VERSIONS+=`, and if it's not already there, add `pgsql=9.5` to the list. Now, whenever you attempt to install a pkg() that depends on postgresql93, pkg() will barf with the error that shiny-new-port depends on postgresql93, but postgresql is marked forbidden. So at this point, you can cd to /usr/ports/category/shiny-new-port, and issue `make install clean`, or tell ports-mgmt/synth to make the package, and install it for you. Simple. No? 

All the best.

--Chris


----------

