> ## Documentation Index
> Fetch the complete documentation index at: https://docs.synq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Postgres

> Integrating Postgres with Coalesce Quality

<Note>
  This guide explains how to connect Coalesce Quality to Postgres securely.

  We need this information so we can collect metadata about your tables.

  To be able to finish this guide, you’ll need the following:
  <br /> → Access to modify your Postgres configuration

  ⏱️ Estimated time to finish: 10 minutes.
</Note>

Coalesce Quality uses the `pg_monitor` role by default, which reads/executes various monitoring views and functions. See more in the [Postgres documentation](https://www.postgresql.org/docs/current/predefined-roles.html).

The following setup:

1. Creates a dedicated user and user group for Coalesce Quality
2. Grants the necessary permissions

## Create a dedicated user with sufficient permissions

```sql theme={null}
CREATE USER synq_user WITH PASSWORD '<password>';
CREATE ROLE synq_group;
GRANT synq_group TO synq_user;
GRANT pg_monitor TO synq_group;
```

<Note>
  On Amazon RDS / Aurora you must run `GRANT pg_monitor TO synq_group` as a user
  that has the `rds_superuser` role.
</Note>

## Grant permissions to the relevant schemas

```sql theme={null}
GRANT USAGE ON SCHEMA "schema" TO synq_group;
GRANT SELECT ON ALL TABLES IN SCHEMA "schema" TO synq_group;
ALTER DEFAULT PRIVILEGES FOR ROLE "table_owner" IN SCHEMA "schema"
  GRANT SELECT ON TABLES TO synq_group;
```

Run these for every schema you want Coalesce Quality to monitor.

<Warning>
  `ALTER DEFAULT PRIVILEGES` only affects tables created by the role you name in
  `FOR ROLE`. Set `"table_owner"` to the role that actually creates your tables
  (usually your application or migration user) — otherwise `synq_group` will not
  get `SELECT` on tables added in the future, and newly created tables will silently
  stop being monitored. If several roles create tables in the schema, repeat the
  statement once per owner.
</Warning>

## Network Configuration

Depending on your database configurations, you may need to whitelist Coalesce Quality's IP addresses in your firewall or security groups. See [IP Whitelist](/security/ip) for the complete list of IP addresses by region.

## Input data in the UI

### Integration name

E.g., `postgres`

### Database

The name of your Postgres database

### Host

The name of your host, e.g., `database-1.<host>.eu-north-1.rds.amazonaws.com`

### Port

The default is `5432`

### Username and password

Username and password you specified earlier in the guide
