## pgpro_upgrade

pgpro_upgrade — upgrade a Postgres Pro database cluster to a minor update version

## Synopsis

`pgpro_upgrade` [{ `-D` | `--pgdata` }`directory`] [ `--check` ]

`pgpro_upgrade` [ `--help` ]

## Description

pgpro_upgrade is a shell script provided in the Postgres Pro distribution to facilitate Postgres Pro upgrades to minor update versions based on the same PostgreSQL major version. This script checks whether the new version introduces any system catalog changes and adds the corresponding features into the catalog of the existing database cluster. When run without any options, pgpro_upgrade upgrades the cluster specified in the `PGDATA` environment variable.

## Options

pgpro_upgrade accepts the following command-line arguments:

`-D `directory``
`--pgdata `directory``

  Specify the data directory of the database cluster to be upgraded. By default, pgpro_upgrade upgrades the cluster specified in the `PGDATA` environment variable.

`--check`

  Check whether the specified database cluster needs to be upgraded, without changing any data. Return values are:

  - 0 if no changes are required.

  - 1 if the cluster needs to be upgraded.

`-h`
`--help`

  Show help, then exit.

## Usage

For Postgres Pro minor updates that introduce any system catalog changes as compared to the previous version, `pgpro_upgrade` must be run to update system catalogs after installing such updates. If you are upgrading your Postgres Pro installation from a binary package, the `pgpro_upgrade` script is run automatically, unless you are prompted to run it manually. If you have compiled Postgres Pro from source code or created your database in a non-default location, you must run the `pgpro_upgrade` script manually.

By default, `pgpro_upgrade` is located in ``install-dir`/bin`, where ``install-dir`` is the Postgres Pro installation directory. To manually run `pgpro_upgrade`, follow this procedure:

1. Stop the `postgres` service.

2. Install the new Postgres Pro version into your current installation directory.

3. On behalf of the system user owning the database, run the `pgpro_upgrade` script with the `-D` option specifying the database cluster to upgrade:

       install-dir/bin/pgpro_upgrade -D directory

   The script checks whether any changes are needed and updates the system catalogs accordingly, if required.

### Note

On Windows systems, you can also run `pgpro_upgrade` using ``install-dir`/scripts/pgpro_upgrade.cmd` wrapper provided for convenience. This wrapper launches the `pgpro_upgrade` script for the default database cluster, without taking any arguments.

## See Also

pg_upgrade