# PostgreSQL privileges for read-only connection user in pg\_ro\_user

**URL:** <https://discuss.konghq.com/t/postgresql-privileges-for-read-only-connection-user-in-pg-ro-user/8174>\
**Category:** General\
**Created:** [April 6, 2021, 1:56pm UTC](https://discuss.konghq.com/t/postgresql-privileges-for-read-only-connection-user-in-pg-ro-user/8174 "2021-04-06T13:56:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mloskot](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mloskot/32/2259_2.png) [@mloskot](https://discuss.konghq.com/u/mloskot)\
**Post date:** [April 6, 2021, 1:56pm UTC](https://discuss.konghq.com/t/postgresql-privileges-for-read-only-connection-user-in-pg-ro-user/8174/1 "2021-04-06T13:56:56Z")

</div>

TL;TR: What are the required privileges for the read-only connection user?

Here is how I’m setting up the `kongro` user which I’m configuring the Kong with via `KONG_PG_RO_USER=kongro`:

```auto
CREATE USER kongro WITH PASSWORD 'secret';
GRANT CONNECT ON DATABASE kong TO kongro;
GRANT USAGE ON SCHEMA public TO kongro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO kongro;
GRANT REFERENCES ON ALL TABLES IN SCHEMA public TO kongro;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO kongro;

```

However, I still see in the logs the messages like this:

```auto
could not rebuild router: could not load routes:
[postgres] ERROR: permission denied for relation routes (stale router will be used)

```

If I replace the `kongro` with username for the read-write connection, those disappear from the logs and all seems working fine.

How to configure the read-only connection user?

---

<div class="post-metadata">

**Author:** ![datong.sun](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/datong.sun/32/816_2.png) [@datong.sun](https://discuss.konghq.com/u/datong.sun)\
**Post date:** [April 7, 2021, 3:23pm UTC](https://discuss.konghq.com/t/postgresql-privileges-for-read-only-connection-user-in-pg-ro-user/8174/2 "2021-04-07T15:23:29Z")

</div>

Hello,

You can use [feat(postgres) create read-only user 'kong\_ro' · thibaultcha/kong-tests-compose@32d7dec · GitHub](https://github.com/thibaultcha/kong-tests-compose/commit/32d7dec10f294cef12f52ee32fb4ec769749cf11) as a reference when we created a readonly user for the Kong’s CI environment.

---

<div class="post-metadata">

**Author:** ![mloskot](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mloskot/32/2259_2.png) [@mloskot](https://discuss.konghq.com/u/mloskot)\
**Post date:** [April 7, 2021, 4:32pm UTC](https://discuss.konghq.com/t/postgresql-privileges-for-read-only-connection-user-in-pg-ro-user/8174/3 "2021-04-07T16:32:10Z")

</div>

This is helpful, thank you!
