Re: Postgres upgrade from 12 to 13 - anyway to fetch EOL package?

From: Kaya Saman <kayasaman_at_optiplex-networks.com>
Date: Fri, 11 Jul 2025 15:21:56 UTC
On 7/11/25 2:19 PM, Kaya Saman wrote:
>
> On 7/10/25 8:19 PM, list_freebsd@bluerosetech.com wrote:
>> On 2025-07-10 1:55, Kaya Saman wrote:
>>> I've recently updated my servers to 13.5 and now I'm updating all 
>>> the @ports
>>>
>>>
>>> I have a jail with postgres installed but forgot to check
>>> /usr/ports/UPDATING for the upgrade procedure.
>>>
>>>
>>> Does anyone know if there's a location with obsolete packages so I can
>>> grab the pg12 package?
>>>
>>>
>>> According to UPDATING I need both of these:
>>>
>>>
>>>     # pkg create postgresql12-server postgresql12-contrib
>>>     # tar xf postgresql12-server-12.8.pkg -C /tmp/pg-upgrade
>>>     # tar xf postgresql12-contrib-12.8.pkg -C /tmp/pg-upgrade
>>>
>>>
>>> Or is there another solution to get my databases upgraded?
>>
>> Check to see if you have the old pkgs in /var/cache/pkg
>>
>> If not, you can look up when databases/postgresql12-* was deleted 
>> from the tree, check out ports at the commit just before that, make 
>> stage package, unpack as needed.
>
>
> Many thanks for the suggestion!
>
>
> Currently I found the source code from here:
>
>
> https://ftp.postgresql.org/pub/source/v12.8/
>
>
> I'm not sure which version of 12.x was installed but I'm trying 12.8 
> in any case. I don't think I need to install it? Right now I just ran 
> the "make" command.
>
>
> Hopefully then it will just be a case of following the instructions 
> from 'post 2' from here:
>
>
> https://forums.freebsd.org/threads/pkg-upgrade-installations-of-postgresql13-client-then-conflicting-postgresql12-client-and-then-an-sqlite-error.82931/ 
>
>
>
> su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d 
> /var/db/postgres/data10 -B /usr/local/bin/ -D /var/db/postgres/data13/ 
> -U postgres "
>
>
> - but using data12 instead ;-)
>
>
> I think I would need to adapt this line to:
>
>
> "/tmp/postgresql-12.8/src/bin/pg_upgrade 
> -b /tmp/postgresql-12.8/src/bin" as the source directories
>
>

This is what I ended up doing:


cd /tmp

wget https://ftp.postgresql.org/pub/source/v12.8/postgresql-12.8.tar.gz

tar xzf postgresql-12.8.tar.gz

mkdir /tmp/pgsql

cd postgresql-12.8

make clean #because I screwed up as I didn't run the ./configure script 
properly

./configure --prefix=/tmp/pgsql

make

make install

cd /tmp/pgsql

su -l postgres -c "pg_upgrade -b /tmp//pgsql/bin -d 
/var/db/postgres/data12 -B /usr/local/bin/ -D /var/db/postgres/data13/ 
-U postgres "

/usr/local/etc/rc.d/postgresql start


There were two post upgrade suggestions which I've lost now, in terms of 
running two scripts:

analyze_new_cluster.sh - was one but I've lost the other :-(


Postgres13 started fine so it is kind of done ;-)