I recently rebuilt a data container that was 2 years old. The new container expected different permissions than the old one did, presumably because the postgres user and group had new IDs in the current base OS.
I fixed it by running this inside the container:
chown -R postgres:postgres /shared/postgres_*
Maybe in a single-container setup this isn’t necessary because a chown gets done in some other template?
The next rebuild failed because the discourse user was not allowed to enable the pgvector extension. I resolved this by running this query in postgres as the postgres user: