I just upgraded Postgres 10.0 to 10.1 and it was a very fast and easy upgrade.
I downloaded the binaries from https://www.enterprisedb.com/download-postgresql-binaries and unzipped them to C:\postgres
, then renamed the directory pgsql
to pgsql-10.1
so that I can keep older versions until deemed unnecessary.
I copied the dll files msvcp120.dll
and msvcr120.dll
to C:\postgres\pgsql-10.1\bin
because I prefer that simple installation over the "Installer" which probably adds much more bloat than needed.
I then used this simple batch script which I wrote in the past:
set MAJOR_VERSION=10
set MINOR_VERSION=1
set SERVICE_NAME=pgsql-%MAJOR_VERSION%.%MINOR_VERSION%
set PGHOME=C:\postgres\%SERVICE_NAME%
set PGDATA=C:\postgres\pgdata%MAJOR_VERSION%
%PGHOME%\bin\pg_ctl.exe register -N %SERVICE_NAME% -U LocalSystem -S auto --pgdata=%PGDATA%
::: to unregister old service:
::%PGHOME%\bin\pg_ctl.exe unregister -N %SERVICE_NAME%
I ran SELECT version();
in psql to confirm the old version:
postgres=# select version();
-[ RECORD 1 ]-------------------------------------------------------
version | PostgreSQL 10.0, compiled by Visual C++ build 1800, 64-bit
I then ran the batch script above which installed a service named postgres-10.1
.
I stopped the old service and set its Startup Type
to Disabled
, and started the new service.
Running SELECT version();
again in psql confirmed the upgrade (had to run it twice due to the connection being aborted when I stopped the old server):
postgres=# select version();
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
postgres=# select version();
-[ RECORD 1 ]-------------------------------------------------------
version | PostgreSQL 10.1, compiled by Visual C++ build 1800, 64-bit
Keep in mind that upgrading a major version requires updating the data directory with pg_upgrade
or some other method, but for a minor upgrade this method worked like a charm.
e.g. ...
part. – isapir Mar 6 '18 at 17:41