All connectors

Database

PostgreSQL

PostgreSQL Connector

Index the tables of a PostgreSQL database, hosted or self-managed: the assistant answers from the real rows instead of a schema description.

Prerequisites

  • A PostgreSQL database you can read, version 12 or later
  • A role with `CONNECT` on the database and `SELECT` on the tables to index
  • The database name, and its host and port if it is not local

Data ingested

When you connect PostgreSQL, the following content becomes searchable. Every answer that uses it cites it.

ContentWhat is kept
TablesEvery table and view listed in `information_schema`, one document per table
RowsUp to 500 rows per table, each row rendered as `column = value` pairs
Column typesValues are cast to text server-side, so `NUMERIC`, `DATE`, `UUID`, `JSON` and arrays all survive

Setup

Configuration happens in the dashboard, under Integrations. No API call is needed for a normal setup.

1

Create a read-only role

`CREATE ROLE qm_reader LOGIN PASSWORD '...'; GRANT CONNECT ON DATABASE mydb TO qm_reader; GRANT SELECT ON ALL TABLES IN SCHEMA public TO qm_reader;` Read-only is enough: the connector opens a `READ ONLY` transaction and never writes.

2

Enter the connection

Integrations → Add source → PostgreSQL: host, port (5432 by default), database and user. Or paste a full `postgres://` URL in the **URL** field.

3

Set the secret

The role password, in the **Secret** field. Leave it empty when the URL already contains it.

4

Connect and sync

**Test** lists the tables the connector can see without indexing anything; **Sync** reads them and indexes the content.

Where the credential goes
The password goes in the **Secret** field. It is stored server-side and never returned by the API: `GET /api/connectors` omits it. A connection URL or DSN can be given instead of the separate fields, and it then carries the credentials itself.

Configuration options

FieldDescriptionRequired
URL or DSNFull `postgres://user:password@host:port/database`. Takes precedence over the separate fieldsNo
HostDatabase host. Defaults to `127.0.0.1`No
PortDatabase port. Defaults to `5432`No
DatabaseName of the database to indexYes
UserRole used to connectYes
SecretPassword of that roleNo
SchemaRestrict indexing to one schema. Empty means every non-system schemaNo

Best practices

  • •Index a reporting or replica database rather than the primary: a sync reads up to 500 rows per table and that load should not land on production traffic.
  • •Grant `SELECT` only on the tables that carry knowledge. An `audit_log` or a `sessions` table adds noise and personal data to the corpus.
  • •System schemas are skipped automatically (`pg_catalog`, `information_schema`, `pg_toast`), so there is no need to exclude them.

Troubleshooting

`config.database est requis`

The **Database** field is empty. It is the only field the connector refuses to guess.

`password authentication failed`

The password is in the **Secret** field, not in the config. When a URL is given, it must carry the password itself.

A table is missing from the result

The role lacks `SELECT` on it, or it lives in a schema excluded by the **Schema** field.

`TLS` / certificate error

The connector verifies the server certificate against the webpki roots and falls back to plaintext only when the server does not offer TLS. A managed host with a private CA is not covered yet.

Next steps

Once the source is connected and indexed, ask a question from the chat and check that the answer cites this source. A source that never appears in a citation is usually a source with nothing indexed: see Troubleshooting above.