You might want to create and run the debug pod with the user it was originally planned for, otherwise you will receive permission denied while running commands inside the pod.
This is the sequence of steps I executed:
oc get -o yaml pod <postgresql-pod> | grep runAsUser
runAsUser: 1000650000
oc scale deployment/<postgresql-d> --replicas=0
deployment.apps/<postgresql-d> scaled
oc debug deployment/<postgresql-d> --as-user=1000650000
Starting pod/<postgresql-debug> ...
Pod IP: 10.128.2.75
If you don't see a command prompt, try pressing enter.
sh-4.2$ run-postgresql
pg_ctl: another server might be running; trying to start server anyway
waiting for server to start....2021-11-17 09:09:46.428 UTC [25] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-11-17 09:09:46.429 UTC [25] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2021-11-17 09:09:46.445 UTC [25] LOG: redirecting log output to logging collector process
2021-11-17 09:09:46.445 UTC [25] HINT: Future log output will appear in directory "log".
. done
server started
/var/run/postgresql:5432 - accepting connections
=> sourcing /usr/share/container-scripts/postgresql/start/set_passwords.sh ...
ERROR: tuple concurrently updated
sh-4.2$ pg_ctl stop -D /var/lib/pgsql/data/userdata
waiting for server to shut down.... done
server stopped
sh-4.2$ pg_ctl start -D /var/lib/pgsql/data/userdata
waiting for server to start....2021-11-17 09:10:19.359 UTC [45] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-11-17 09:10:19.359 UTC [45] LOG: listening on IPv6 address "::", port 5432
2021-11-17 09:10:19.369 UTC [45] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-11-17 09:10:19.377 UTC [45] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2021-11-17 09:10:19.558 UTC [45] LOG: redirecting log output to logging collector process
2021-11-17 09:10:19.558 UTC [45] HINT: Future log output will appear in directory "log".
done
server started
sh-4.2$
sh-4.2$
sh-4.2$
sh-4.2$ pg_ctl stop -D /var/lib/pgsql/data/userdata
waiting for server to shut down.... done
server stopped
sh-4.2$ exit
exit
Removing debug pod ...
oc scale deployment/<postgresql-d> --replicas=1
deployment.apps/<postgresql-d> scaled