Cherry-pick https://github.com/postgres/postgres/commit/2e4229691c6 to https://github.com/postgres/postgres/commit/dfb5ad7cf0d
Cherry-pick postgres/postgres@2e4229691c6 to postgres/postgres@dfb5ad7cf0d