diff --git a/debian/changelog b/debian/changelog
index 9401318e5007456dc88e0293f3a59b03463f0e48..6e85a2cac36db75d334f6e528bafa6ba549cc2ef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+postgresql-common (276) UNRELEASED; urgency=medium
+
+  * pg_virtualenv: Use PG18's extension_control_path to find extensions in
+    temporary build paths instead of our custom extension_destdir patch.
+
+ -- Christoph Berg <myon@debian.org>  Wed, 19 Mar 2025 15:43:16 +0100
+
 postgresql-common (275) unstable; urgency=medium
 
   [ Christoph Berg ]
diff --git a/pg_virtualenv b/pg_virtualenv
index f4cfe03874bd192df91b2bdad61b0e53413567c0..537bc289e8903edc75282b7e5c14d027db046fe0 100755
--- a/pg_virtualenv
+++ b/pg_virtualenv
@@ -189,12 +189,20 @@ fi
 for v in $PG_VERSIONS; do
     # create temporary cluster
     if [ "${PACKAGE:-}" ]; then
-        if ! grep -q 'extension_destdir' /usr/share/postgresql/$v/postgresql.conf.sample; then
-            echo "$0: This PostgreSQL $v installation does not support 'extension_destdir', skipping this version"
-            [ "$PG_VERSIONS" = "$v" ] && exit 0 # only one version requested
-            continue
-        fi
-        PKGARGS="--pgoption extension_destdir=$PWD/debian/$PACKAGE --pgoption dynamic_library_path=$PWD/debian/$PACKAGE/usr/lib/postgresql/$v/lib:/usr/lib/postgresql/$v/lib"
+        case $v in
+            18|19|[2-7]*) # find extension using extension_control_path
+                PKGARGS="--pgoption extension_control_path=$PWD/debian/$PACKAGE/usr/share/postgresql/$v/extension:\$system --pgoption dynamic_library_path=$PWD/debian/$PACKAGE/usr/lib/postgresql/$v/lib:/usr/lib/postgresql/$v/lib"
+                ;;
+            *) # older versions have a Debian-specific patch
+                if grep -q 'extension_destdir' /usr/share/postgresql/$v/postgresql.conf.sample; then
+                    PKGARGS="--pgoption extension_destdir=$PWD/debian/$PACKAGE --pgoption dynamic_library_path=$PWD/debian/$PACKAGE/usr/lib/postgresql/$v/lib:/usr/lib/postgresql/$v/lib"
+                else
+                    echo "$0: This PostgreSQL $v installation does not support 'extension_destdir', skipping this version"
+                    [ "$PG_VERSIONS" = "$v" ] && exit 0 # only one version requested
+                    continue
+                fi
+                ;;
+        esac
     fi
     # we chdir to / so programs don't throw "could not change directory to ..."
     (