Problem
In-place major version upgrade from PostgreSQL 14.20 to 18 on Azure Database for PostgreSQL Flexible Server hangs indefinitely. The upgrade never begins — the server stays online at version 14 and is never taken offline for pg_upgrade.
Region: West US 2 SKU: Standard_D2ds_v4 (General Purpose) Current Version: PostgreSQL 14.20 Target Version: PostgreSQL 18 PgBouncer: Enabled (built-in)
Root Cause (suspected)
The postgres database contains Azure-managed objects created by the built-in PgBouncer feature that appear to silently block the pg_upgrade precheck:
SELECT fdwname, fdwowner::regrole FROM pg_foreign_data_wrapper;
The upgrade documentation states that postgres_fdw blocks upgrades. We believe dblink_fdw is being treated the same way by pg_upgrade. Since all these objects are owned by azuresu, we cannot drop them as azure_pg_admin users.
What we tried
Azure CLI (az postgres flexible-server upgrade --version 18 --yes): Hangs indefinitely. Debug logs (--debug) show two GET requests to the server resource but the PUT/PATCH to trigger the upgrade is never sent. CLI version 2.84.0.
Azure Portal (Overview > Upgrade > version 18): Shows "Deployment is in progress" but the server remains on version 14, stays online, and never begins the actual pg_upgrade. Ran for 80+ minutes with no progress before we cancelled.
REST API (PATCH to flexibleServers endpoint with {"properties":{"version":"18"}}): Returns an operation ID but the server version never changes.
Disabled PgBouncer (pgbouncer.enabled = FALSE) before attempting upgrade: The parameter changes but the dblink_fdw, pgbouncer foreign server, and all pgbouncer views remain in the postgres database. Upgrade still hangs.
Manual DROP: Cannot drop any of these objects — all owned by azuresu:
ERROR: must be owner of schema pgbouncer
Server configuration
Storage: 128 GB (8.4% used) — well above the 10-20% free space requirement
No read replicas
No high availability
No logical replication slots
No event triggers
No blocking extensions (no timescaledb, postgres_fdw, age, azure_ai, hll, pg_diskann, pgrouting)
Extensions in user databases: PostGIS 3.5.2, uuid-ossp 1.1 (both supported on PG 18)
23 databases including 2 custom template databases (unlocked before upgrade attempt)
Question
How can we perform the major version upgrade when dblink_fdw and the pgbouncer foreign server (both owned by azuresu) are blocking pg_upgrade? Is there a workaround, or does Azure need to remove these objects on the backend?
This affects our upgrade path for Dev, Test, and Prod environments — all have PgBouncer enabled.
Problem
In-place major version upgrade from PostgreSQL 14.20 to 18 on Azure Database for PostgreSQL Flexible Server hangs indefinitely. The upgrade never begins — the server stays online at version 14 and is never taken offline for pg_upgrade.
Region: West US 2 SKU: Standard_D2ds_v4 (General Purpose) Current Version: PostgreSQL 14.20 Target Version: PostgreSQL 18 PgBouncer: Enabled (built-in)
Root Cause (suspected)
The postgres database contains Azure-managed objects created by the built-in PgBouncer feature that appear to silently block the pg_upgrade precheck:
SELECT fdwname, fdwowner::regrole FROM pg_foreign_data_wrapper;
The upgrade documentation states that postgres_fdw blocks upgrades. We believe dblink_fdw is being treated the same way by pg_upgrade. Since all these objects are owned by azuresu, we cannot drop them as azure_pg_admin users.
What we tried
Azure CLI (az postgres flexible-server upgrade --version 18 --yes): Hangs indefinitely. Debug logs (--debug) show two GET requests to the server resource but the PUT/PATCH to trigger the upgrade is never sent. CLI version 2.84.0.
Azure Portal (Overview > Upgrade > version 18): Shows "Deployment is in progress" but the server remains on version 14, stays online, and never begins the actual pg_upgrade. Ran for 80+ minutes with no progress before we cancelled.
REST API (PATCH to flexibleServers endpoint with {"properties":{"version":"18"}}): Returns an operation ID but the server version never changes.
Disabled PgBouncer (pgbouncer.enabled = FALSE) before attempting upgrade: The parameter changes but the dblink_fdw, pgbouncer foreign server, and all pgbouncer views remain in the postgres database. Upgrade still hangs.
Manual DROP: Cannot drop any of these objects — all owned by azuresu:
ERROR: must be owner of schema pgbouncer
Server configuration
Storage: 128 GB (8.4% used) — well above the 10-20% free space requirement
No read replicas
No high availability
No logical replication slots
No event triggers
No blocking extensions (no timescaledb, postgres_fdw, age, azure_ai, hll, pg_diskann, pgrouting)
Extensions in user databases: PostGIS 3.5.2, uuid-ossp 1.1 (both supported on PG 18)
23 databases including 2 custom template databases (unlocked before upgrade attempt)
Question
How can we perform the major version upgrade when dblink_fdw and the pgbouncer foreign server (both owned by azuresu) are blocking pg_upgrade? Is there a workaround, or does Azure need to remove these objects on the backend?