I am not using docker.
Nextcloud is using the php-postgresql package to connect to an db server.
That was just a hint/ideal to fix your issue.
You can fine-tune the access there and there are also the db permissions within the db itself.
p.s. next time please use the support template to provide all information to help you.