Hi Alexander,
On Sat, Nov 28, 2026, PG Bug reporting form wrote:
> pg_restore: error: could not execute query: ERROR: permission denied to
> change owner of foreign-data wrapper "foo1"
I can reproduce both cases on 15 through master. The attached patch
skips the superuser check on the new owner during binary upgrade, so
pg_upgrade keeps the demoted owner. Plain OWNER TO still checks it.
On 15 a subscription with a demoted owner fails the same way, so a
backpatch there needs that check too.
Thanks,
Shihao