RDS for PostgreSQL allows you to upgrade the major version of your DB instance in either of the following methods:
After the major version upgrade pre-check is passed, if any extension listed in Table 1 is detected in the upgrade path, remove the extension before the upgrade is performed and reinstall it after the upgrade is complete. If you perform the upgrade without removing this extension, the upgrade will fail, or the extension cannot be used after the instance is upgraded.
Source Version | Target Version | Extension That Can Cause an Upgrade Failure | Extension That Cannot Be Used After an Instance Upgrade |
|---|---|---|---|
12 | 13 | orafce, postgis_sfcgal | address_standardizer_data_us, pgaudit |
14 | orafce, postgis_sfcgal | anon, pgaudit | |
15 | orafce, postgis_sfcgal | anon, pgaudit | |
16 | orafce, postgis_sfcgal, pgl_ddl_deploy | anon, pgaudit | |
17 | orafce, pgl_ddl_deploy, postgis, postgis_raster, postgis_topology, postgis_tiger_geocoder, postgis_sfcgal | anon, pgaudit | |
13 | 14 | - | anon, pgaudit, pg_stat_kcache |
15 | - | anon, pgaudit, pg_stat_kcache | |
16 | pgl_ddl_deploy | anon, pgaudit, pg_stat_kcache | |
17 | pgl_ddl_deploy, postgis, postgis_raster, postgis_topology, postgis_tiger_geocoder, postgis_sfcgal | anon, pgaudit, pg_stat_kcache, powa | |
14 | 15 | - | pgaudit, pg_stat_kcache |
16 | pgl_ddl_deploy | pgaudit, pg_stat_kcache | |
17 | pgl_ddl_deploy, postgis, postgis_raster, postgis_topology, postgis_tiger_geocoder, postgis_sfcgal | pgaudit, pg_stat_kcache, powa | |
15 | 16 | pgl_ddl_deploy | pgaudit |
17 | pgl_ddl_deploy, postgis, postgis_raster, postgis_topology, postgis_tiger_geocoder, postgis_sfcgal | pgaudit, pg_stat_kcache, powa | |
16 | 17 | postgis, postgis_raster, postgis_topology, postgis_tiger_geocoder, postgis_sfcgal | pgaudit, pg_stat_kcache, powa |
The data added after an upgrade is complete will not be automatically synchronized to the original instance.
Upgrading an instance with a workload cutover will set the original instance to read-only and may interrupt your workload for minutes. Schedule this upgrade during off-peak hours. Upgrading an instance without a workload cutover does not affect your workload.
The default_transaction_read_only parameter controls the read-only settings. Before the upgrade, check whether any modification has been made to this parameter. If yes, the data inserted into the instance during the cutover will be lost after the upgrade.
ALTER EXTENSION extension_name UPDATE TO 'new_version';
Certain extensions (such as postgis) will cause the upgrade task to fail. In this case, uninstall the extensions before performing a major version upgrade.
in the upper left corner and select a region and a project.
in the upper left corner of the page and choose Database > Relational Database Service.
in the upper left corner and select a region and a project.
in the upper left corner of the page and choose Database > Relational Database Service.During a major version upgrade, optimizer statistics are not automatically synchronized. Statistics need to be collected after the upgrade is complete.
If an upgrade check or an upgrade fails, you can analyze the causes based on the upgrade check report or upgrade report. The procedure is as follows:
The pg_upgrade_internal.log file is the main log file of an upgrade check report or upgrade report. If an upgrade fails, check for errors in this file. Common errors are as follows:
It means there are extensions that are incompatible with the target version. They are listed in loadable_libraries.txt.
It means there are tables that are created with the WITH OIDS clause and such tables are recorded in tables_with_oids.txt. The WITH OIDS clause is not supported by RDS for PostgreSQL 12 or later.
It means that the target version failed to start during the upgrade check and you can check pg_upgrade_server.log for the causes.
It means that pg_dump failed to back up data during the upgrade and you can check pg_upgrade_dump_xxxx.log for the causes.
Users whose names start with pg_ are not allowed in the target version. Delete or rename these users first.
There is the function parameter type anyarray or anyelement that is incompatible with the target version. Delete the function definitions before the upgrade. After the upgrade is complete, restore the functions and change the parameter type (from anyarray to anycompatiblearray or anyelement to anycompatible). The function objects are recorded in the incompatible_polymorphics.txt file.
This item displays incompatible libraries, which usually correspond to incompatible extensions. Check the extensions listed in loadable_libraries.txt and determine whether to delete them. Delete them before the upgrade if you are sure that the deletion will not affect workloads.
This item displays tables created with the WITH OIDS clause. Check the tables listed in tables_with_oids.txt and evaluate whether the workload code depends on the OIDs. If stripping OIDs from the tables does not affect workloads, run the following SQL statement:
ALTER TABLE {table_name} SET WITHOUT OIDS;
Check the last several lines of the pg_upgrade_server.log file. If an error similar to the following appears, the extension displayed in this error does not exist in the target version. Delete it from shared_preload_libraries as required and then perform the upgrade.
FATAL: could not access file "xxx": No such file or directory.
Example:
FATAL: could not access file "pg_pathman": No such file or directory.
pg_dump: error: query failed: ERROR: out of shared memoryHINT: You might need to increase max_locks_per_transaction.pg_dump:error: query was: LOCK TABLE "xxx"."xxx" IN ACCESSSHARE MODE
pg_restore: error: could not execute query: ERROR: could not find function "xxx" in file xxxCommand was: CREATE FUNCTION "pgl_ddl_deploy"."xxx"