Upgrading PostgreSQL extensions during a major upgrade

Extensions decide whether a PostgreSQL major upgrade is quick or stalls at cutover. This page explains how to pair each extension version with the new server, install matching shared objects and run the post-upgrade update script.

On this page

Why extension versions decide your PostgreSQL major upgrade path

Extension compatibility is the step most likely to block a major upgrade cutover, because every extension your cluster loads needs a build that matches the new server binaries. If you run PostGIS, pgvector, TimescaleDB or pgAudit on a self-hosted cluster, each one must have a compiled version for the target PostgreSQL major release before you touch production data. The core server may upgrade cleanly while a single extension holds the whole change window hostage, so the extension inventory belongs in the first week of planning, not the last.

The timing pressure is concrete. PostgreSQL 14 reaches end of life on November 12, 2026, so clusters on that release need a move to a supported major version. PostgreSQL 18 is supported until November 14, 2030, which makes it the common target for a planned move from 14 in this series. Check each extension's own release notes and packaging for PostgreSQL 18 support, and confirm with your operating system packager that builds exist for your distribution. Do not assume that an extension version that works on 17 will load on 18 without a rebuild.

The path you choose, either pg_upgrade or logical replication, changes how extensions are handled, so confirm the details on the sibling pages for those methods before fixing the plan. Whichever path you take, record for each extension the installed version, the target build, and who owns the rebuild if none exists. Ask your vendor or the extension maintainers to confirm supported PostgreSQL major versions in writing for your exact versions, because a support statement for the extension's latest release may not cover the release you run today.

What changes for extensions across a major upgrade

This table compares each change in the PostgreSQL 18 upgrade path with what it does to extensions such as PostGIS, pgvector, TimescaleDB and pgAudit, and the check the team runs for it. Read each row as a gate: confirm the action is complete before the cutover window. The main takeaway is that extension binaries and the post-upgrade update step matter more than the planner or authentication changes for most extension-heavy clusters.

ChangeImpact on extensionsAction needed
pg_upgrade keeps planner statistics in PostgreSQL 18Extension-backed queries can keep their existing plans after upgrade, so slow plans are less likely to appear at cutoverRun a query timing comparison on extension-heavy workloads in the rehearsal, then confirm whether ANALYZE is still needed
pg_upgrade needs matching extension shared objects in the new clusterThe upgrade fails or the extension cannot load if the new server binaries lack the matching shared object filesInstall the target-version packages for each extension on the new server before running pg_upgrade --check
Extension schema is not loaded during the upgradeExtension SQL objects are carried over from the old cluster, so the new cluster must not be created with CREATE EXTENSION firstConfirm the new cluster is empty of extension objects, then compare extension versions in old and new catalogs
pg_upgrade reports extension updates through a script to run afterwardsExtensions may be left at an older version until the generated update script runsRun the generated script after the upgrade, then check pg_extension versions against the pairing matrix for each extension
PostgreSQL 18 deprecates MD5 in favor of SCRAMExtension connections are affected only where a client, proxy or extension background worker still authenticates with MD5Search pg_hba.conf and client connection strings for MD5 and test each extension's connection path with SCRAM
PostgreSQL 18 adds asynchronous I/O and virtual generated columns by defaultExtensions that depend on storage behavior, generated columns or I/O timing need testing against the new defaultsRun each extension's test suite and workload tests on PostgreSQL 18 before scheduling production cutover

What to inventory and test before the cutover

Extension upgrades fail on details that are easy to miss until the cutover window: an extension that is installed in one database but not another, a build that does not exist for the target version, or a custom object that depends on an extension function. The cards below set out the checks that connect those risks, in the order most teams work through them.

Inventory every extension and version

List each installed extension, its version and the databases that contain it. Query the extension catalog in every database, not only the default one, because an extension installed in an application database is easy to overlook. Record which schemas own each extension and whether any database runs an extension that is not in your configuration management. This list is the baseline for every later check, so keep it in version control with the cluster build.

Confirm target-version builds exist

For each extension, confirm with the maintainer or your package source that a build exists for the target PostgreSQL major version and matches the target server binaries. Do not assume a build exists because the extension is popular. Ask the maintainer about support for the target version, the required shared object files and any known issues. Record the exact package names and versions you will install, because the new cluster needs matching shared objects before pg_upgrade runs.

pg_upgrade docs

Back up and prove the restore

Take a full backup of the cluster before any change, and restore it to a separate host to confirm it works. A backup that has never been restored is a hypothesis. Include the configuration files and extension packages, because a restored cluster without the matching shared objects will not start cleanly. Record how long the restore took and what it needed, since that is the rollback time you will quote to stakeholders.

Build a test environment with the same extensions

Create a non-production cluster on the target version with the same extension set, the same versions where possible and a recent copy of the data. Run the full pg_upgrade rehearsal there, including the extension update script it reports. Test the application queries that use extension functions, such as spatial, vector or time-series operations, because a successful upgrade can still return different results or slower plans. Keep the test environment configuration close enough to production that the rehearsal answers the cutover question.

Record dependent custom objects

Find custom functions, types, operators, views, indexes and triggers that reference extension objects, such as a geometry type or a vector distance operator. Those objects can block an extension update or break after it. Export their definitions, name the owning team and note which applications call them. Confirm each extension's dependency behavior with its documentation before you assume a dropped and recreated object will be restored correctly.

Document the rollback path

Write down what you will do if the upgraded cluster fails after cutover: which backup you restore, which packages return to the old versions and who approves the decision. Confirm that the old cluster is kept intact for the agreed period. Extension packages for the old version must stay available until rollback is no longer needed, so verify that the package mirror will not remove them during the change window.

How to install and update extensions during the upgrade

This sequence confirms extension compatibility, stages matching shared objects in the new cluster, validates the upgrade with pg_upgrade checks, and ends with verified extensions and a defined rollback point.

  1. Confirm version pairing for each extension

    Before touching any server, list every installed extension on the old cluster with its exact version, then confirm with each project's release notes or compatibility matrix that a build exists for the target PostgreSQL major version. Record the pairing in a table that names the extension, current version, target version and the package or build source. Ask the vendor or community maintainer to confirm builds for any extension without a published target version. The step is done when every extension has a confirmed target build, and any extension without one is flagged as a blocker for the cutover plan.

  2. Install matching shared objects in the new cluster

    On the host or image that will run the new server binaries, install the extension packages built for the target major version so their shared object files match those binaries. Do not run CREATE EXTENSION at this stage, because pg_upgrade restores the schema objects itself. Confirm the files are present in the new installation's extension directories and that the package versions match the pairing table. The step is done when each extension's shared object files exist under the new server's library and extension paths and the package manager reports the expected versions.

  3. Run pg_upgrade in check mode

    Run pg_upgrade with its check option against the old and new data directories and binaries, without making any changes to the old cluster. Read every warning and failure in the output, especially those naming extensions, libraries or unsupported objects. Fix each reported problem, such as a missing shared object, a library path mismatch or an incompatible function, then rerun the check until it completes without errors. The step is done when the check mode reports that the clusters are compatible and lists no blocking extension issues.

  4. Run the upgrade and the generated extension update script

    Perform the upgrade using the method chosen for your downtime budget. When pg_upgrade finishes, it writes a script that reports which extensions have available updates. Run that script against each database that contains the extensions, reviewing the statements before execution in a rehearsal copy first. Confirm the output shows each extension at its target version in pg_extension for every database. The step is done when the update script completes without errors and a query of pg_extension in each database matches the pairing table.

  5. Run application tests and extension-specific queries

    Start the application against the new cluster in a test environment and run its regression suite. Then run queries specific to each extension, such as spatial functions for PostGIS, nearest-neighbor searches for pgvector, hypertable and chunk queries for TimescaleDB, and audit log output for pgAudit. Compare results with known outputs from the old cluster on the same data. The step is done when application tests pass and each extension-specific query returns the expected results, with any differences explained and signed off by the owning team.

  6. Define and hold the rollback point

    Keep the old cluster intact, with its data directory, binaries and configuration unchanged, until the team confirms the new cluster in writing. Before cutover, record the rollback procedure, including who can authorize it and the time window in which it applies. Changes made to the new cluster after writes begin do not transfer back to the old one, so define which writes are accepted during the hold. The step is done when the rollback owner, decision criteria and retention of the old cluster are documented and the team has signed off.

  7. Decide which steps are reversible

    Document which steps can be undone and how. Installing shared object files in the new cluster and running pg_upgrade in check mode are safe to repeat or remove, since they do not modify the old cluster. Running the upgrade and extension update script is reversible only by returning to the retained old cluster, and only before new writes are accepted. Extension version changes applied in the new cluster are not reversed by simply reinstalling old packages. The step is done when the reversibility table is reviewed and every irreversible action has an approval gate.

How version pairing differs by extension and deployment

When extensions come from the operating system or the PostgreSQL package repository, the matching build is usually published alongside the server packages for the new major version. The package maintainer compiles the extension against that server version, so your main job is to confirm the repository carries a build for the target major version and that it installs into the new cluster's library and extension directories. Distribution and repository packaging is owned by the maintainer, and your team owns the install and the timing.

  • Build source: Confirm the repository lists the extension for the exact target major version, not only the one you run today.
  • Installation target: Install the package on the new cluster's host so the shared objects land where the new binaries look for them.
  • Package lag: Third-party extensions often trail a new server release, so check availability before you schedule the cutover window.
  • Pinned versions: Record the package versions in your change record so the rollback path uses the same builds.
  • Dependency changes: Check that the OS upgrade, if one runs alongside, does not pull in different libraries the extension links against.

Before cutover, run pg_upgrade with its check mode on a copy of the cluster and confirm every extension loads on the new server.

How the old and new clusters, extension builds and update script fit together

The diagram starts with the old cluster and its extension shared object files, which must already match the new server binaries before anything runs. It then shows pg_upgrade running its check and upgrade stages, after which the generated extension update script is run against the new cluster. The final step is verification of each extension, with the old cluster kept intact as the rollback point until the new cluster is accepted.

Extension files, pg_upgrade stages and the update script that follow the cluster move.

What makes extension upgrades take longer

This table lists the factors that add effort to an extension upgrade during a PostgreSQL major upgrade, why each one matters, and what to ask your team or partner to confirm. Read each row against your own inventory, since one driver such as source builds can outweigh the others.

DriverWhy it adds effortWhat to ask for
Number of extensions and databasesEach extension must be checked in every database that uses it, and each database may need its own update script run after the upgrade.A per-database inventory of installed extensions and versions from the current cluster
Extensions compiled from source versus packagedSource builds need a matching compiled build for the new server binaries, so someone must maintain the build chain for each extension.A list of which extensions come from distribution packages and which are built locally, with the build steps documented
Extensions with custom objects or extension typesCustom types, operators and indexes stored in user tables depend on the extension, so changes between versions can require data or schema review.Confirmation of any user tables that use extension types, and the extension release notes for each change
Data volume affecting check and run timeLarger databases make pg_upgrade checks and any extension-dependent index rebuilds take longer, which narrows the window for a cutover.Measured check and rehearsal timings on a copy of production data, not estimates
Number of environments that must matchDevelopment, test, staging and production need the same extension versions paired with the same PostgreSQL major version, or results will differ.A version pairing matrix covering every environment and the target PostgreSQL release
Dependence on authentication changes such as MD5 to SCRAMExtension-related connections, background workers or client tools that still use MD5 must be found and changed before or alongside the upgrade.A list of roles and clients still using MD5 and the driver versions that support SCRAM

Questions teams ask before upgrading PostgreSQL extensions

What drives the cost of upgrading PostgreSQL extensions?

The cost comes mostly from how many extensions the cluster uses, how far each one sits from the version your target PostgreSQL release supports, and how much custom code or configuration depends on them. Each extension needs a build for the new server binaries, a test pass against your own schemas and queries, and a documented rollback. Part of this effort is one-time work during the first upgrade, and part recurs each time an extension or PostgreSQL releases a new version. When you request a quote, ask the partner to list each extension, its version pairing with the target PostgreSQL release, whether a prebuilt package exists or the team must compile it, and which application queries depend on it.

How long does an extension upgrade take, and what sets that duration?

Duration depends on the number of extensions, whether matching builds already exist for your target version, the size and complexity of the schemas that use them, and how many environments must be rehearsed before cutover. Extensions with stable packaging and no custom objects are usually quicker to verify than ones with many dependent views, custom types or indexes that need rebuilding. Ask for a written schedule that separates build and packaging work, rehearsal in a non-production copy, and the change window. Confirm the target PostgreSQL version and the extension versions against each project's documentation before any date is agreed.

Can our own team upgrade extensions without outside help?

Yes, if your engineers can build or install matching extension packages, read the output of pg_upgrade and run the update steps it reports. The work is mostly methodical: install the new shared object files into the new cluster, run pg_upgrade with its check mode, then apply the update script it generates. Teams without experience usually struggle with compiling extensions against new server headers, reconciling version pairings, and testing application behavior after the upgrade. A partner can take on any part of this, from build and packaging to rehearsal, and your team keeps ownership of the decisions. Compare both options using the same written checklist.

What does the work need from our staff?

The work needs named owners who can approve the scope, a non-production environment that mirrors production data and extension configuration closely enough to test, and a change window agreed with the application teams. Database administrators typically confirm the current extension versions, dependent objects and backup status, while application owners provide test cases for queries that use PostGIS, pgvector, TimescaleDB or audit logging. Security or compliance staff should review audit configuration, such as pgAudit settings, before and after the change. Ask the partner which of these inputs they expect from you and when each one is due.

Does an extension without a new build block the PostgreSQL upgrade?

It can. pg_upgrade needs extension shared object files that match the new server binaries installed in the new cluster, so an extension with no build for your target version must be resolved before the cutover. Your options are to compile the extension from source, move to a release that supports the target version, or defer the upgrade until a build exists. Each option changes risk and effort, and some extensions carry compatibility requirements that affect other components. Check each project's release notes and supported PostgreSQL versions, and ask the partner to record the decision for every extension without a build in the written scope.

What should we ask a partner to include in a written scope?

A written scope should name every extension and its current and target version, the target PostgreSQL release, the method for building or installing matching shared objects, and the steps for running pg_upgrade in check mode and applying its generated update script. It should also list the test cases for dependent applications, the rollback plan and the evidence delivered at each stage. Ask who owns each deliverable, which inputs you must supply, what is one-time and what recurs, and how changes to scope are priced and approved. Most engagements of this kind are fixed-scope, so these items should be agreed in writing before work starts.

How do we confirm extension and PostgreSQL version pairing before we start?

Start with the PostgreSQL support dates and the upgrade documentation, then check each extension's own release notes for the PostgreSQL versions it supports. Record the current version of every extension from the running cluster, and compare it with the build available for your target release. Run pg_upgrade in check mode against a copy of the cluster to surface incompatibilities before any production change. Keep the pairing table in your change record so reviewers can see which versions were tested together.

What DeployOpen delivers for an extension upgrade

A written scope for this work usually starts with an extension and version inventory of the source cluster: every installed extension, the version recorded in pg_extension, the packages or builds it was installed from, and which databases load it. The inventory also records who owns each extension in your environment, since PostGIS, pgvector, TimescaleDB and pgAudit often have different release cadences and build sources. From that inventory, DeployOpen prepares a pairing matrix that maps each extension to a version that supports your target PostgreSQL major version, with the packaging source for each one. Where a pairing is not confirmed by the extension maintainer, the matrix marks it as open so your team can decide whether to wait, pin an older combination or accept the risk in writing.

The build or install plan covers the new cluster. It lists the shared object files that must match the new server binaries and must be present before pg_upgrade runs, since the upgrade does not load schema definitions such as CREATE EXTENSION for you. The plan also names the update script that pg_upgrade reports for extensions with available updates, the order in which those scripts run in each database, and how the result is checked. Rehearsal notes record a full run against a copy of production data, the errors seen, the timing observed and the exact changes made to the plan. The cutover runbook and rollback steps then set out the commands, the owner of each step, the checks that must pass before the change window closes and the point at which the old cluster is kept intact for recovery. Your platform team keeps control of production change windows and approves each step before it runs.

Every deliverable is agreed in writing before work starts, including the extensions in scope, the target versions, the environments covered and what is excluded, such as custom extensions or applications that depend on extension behavior. Ask for each deliverable to name its acceptance check, for example a successful rehearsal on a production-sized copy or an agreed list of queries that return the same results before and after. Confirm with the extension maintainers, your vendor or your own build pipeline which pairings are supported, because that information decides how much of the matrix can be closed during planning and how much remains a risk to track.

How DeployOpen works on this

DeployOpen plans, implements, tests, documents and supports self-hosted PostgreSQL in the client's own infrastructure, including the extensions that run alongside it. For extension upgrades, we inventory every extension and its version pairing before the major upgrade, then rehearse the pg_upgrade run in a copy of the environment that matches production.

How we scope

  • Inventory every extension in each database, with its installed version and the server version it pairs with
  • Confirm which target PostgreSQL major version and which extension releases your applications need
  • Agree in writing which databases, environments and rollback steps the fixed-scope engagement covers

How we build

  • Install matching shared object files for each extension in the new cluster before running pg_upgrade
  • Run pg_upgrade checks and rehearse the extension update script in a staging copy of your data
  • Test queries, indexes and extension functions that your applications depend on after the rehearsal

How we hand over

  • Document the version pairing matrix, install steps, update script output and post-upgrade checks
  • Deliver a cutover runbook with the rollback path and the order in which extension updates run
  • Walk your database and platform teams through the procedure and the evidence it produces

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after the upgrade is complete
  • Recheck extension version pairing when you apply PostgreSQL minor releases or plan the next major upgrade
  • Keep the runbook current as extensions and their supported PostgreSQL versions change over time

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.