PostgreSQL · Natural language to verified SQL

Connect PostgreSQL to AI, keep every query as a skill

  • Verified read-only SQL
  • NL→SQL agent for PostgreSQL
  • Reusable AI SQL skills you export to Claude Code, Cursor & Codex

Connect your PostgreSQL database to AI in five fields and ask questions like "revenue by month for Q1". It writes the SQL, runs it read-only against your database, and charts the answer, all without touching a row you didn't grant. Works with Neon, Supabase, Amazon RDS, Google Cloud SQL, and Azure. Jump to how SQL generation works.

Chion turns your PostgreSQL database into an AI SQL analyst: connect read-only, ask in plain English, and turn every verified query into a reusable skill with the SQL skills generator. Your database becomes a question box the whole team can use: no SQL, no write access, no data leaving your result set. Credentials are wrapped in an AES-256-GCM vault, every query runs as a read-only SELECT capped at 1,000 rows, and your row-level security policies are honored on every call. It is the AI SQL workforce for teams on managed Postgres: connect in five fields, in minutes. Point it at a read replica; your primary stays untouched. Export every verified query as a portable SQL skill that runs in Claude Code, Cursor, and Codex.

How Chion connects to PostgreSQL

Five steps from role creation to interactive charts.

  1. 1

    Create a read-only Postgres role

    In your database, grant only what Chion needs:

    CREATE ROLE chion_read LOGIN PASSWORD '<strong-password>';
    GRANT CONNECT ON DATABASE <dbname> TO chion_read;
    GRANT USAGE  ON SCHEMA public       TO chion_read;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO chion_read;
    ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO chion_read;
  2. 2

    Grab the six connection fields

    From your provider's dashboard, collect Host, Port (5432 for direct connections, 6543 for the Supabase transaction pooler, 6432 for the Azure PgBouncer pooler), Database, Schema (default public), User, and Password.

  3. 3

    Paste into Chion

    Open Chion, click Connect PostgreSQL, paste the six fields. Credentials are wrapped in an AES-256-GCM envelope in Supabase Vault, never logged, never shown to the language model, and only unsealed inside the edge function for the duration of one query.

  4. 4

    Chion profiles your schema

    Chion reads table and column metadata (names, types, cardinality) but never samples row data. The schema profile is what the language model sees; rows stay inside your database.

  5. 5

    Ask in plain English

    Type a question. Chion generates SQL, passes it through the multi-stage validator (L1 read-only SELECT check, L2 mode-based validator), executes it read-only with a capped LIMIT of 1,000 rows or 12,000 cells, and renders the result as an interactive D3.js chart. See how conversational analytics works.

Find your credentials

Select your PostgreSQL provider for step-by-step instructions.

FieldWhere to FindDefault
Server (Endpoint)Connectivity & security tab → Endpoint<instance>.<id>.<region>.rds.amazonaws.com
PortSame tab, next to Endpoint5432
DatabaseConfiguration tab → DB namepostgres (or what you set at creation)
SchemaNot in console; default is publicpublic
UserConfiguration tab → Master usernamepostgres (or what you set)
PasswordSet at instance creation. Modify → change Master password to reset(not retrievable)

Quick steps

  1. 1.Log in at console.aws.amazon.com/rds
  2. 2.Click Databases in the left sidebar
  3. 3.Click your PostgreSQL instance name
  4. 4.Connectivity & security tab → copy the Endpoint and Port
  5. 5.Configuration tab → note the DB name and Master username
  6. 6.Password is what you entered during creation (use Modify to reset if needed)
FieldWhere to FindDefault
Server (Host)Overview page → Server name<server>.postgres.database.azure.com
PortOverview or Connection strings page5432
DatabaseCreated by default. Check via Connection strings or psqlpostgres
SchemaNot in portal; default is publicpublic
UserOverview page → Admin usernameWhat you set at creation
PasswordSet at creation. Reset via Settings → Reset password(not retrievable)

Quick steps

  1. 1.Log in at portal.azure.com
  2. 2.Search for "Azure Database for PostgreSQL servers"
  3. 3.Click your server name
  4. 4.On the Overview page: copy the Server name (this is your host) and note the Admin username
  5. 5.Click Connection strings in the left sidebar for pre-built connection strings
  6. 6.Password is what you set during creation; reset via Settings → Reset password if needed

Azure Flexible Server uses port 5432 for direct connections and 6432 for the built-in PgBouncer pooler.

FieldWhere to FindDefault
Server (Host)Overview → Connect to this instance → Public/Private IPIP address (e.g., 34.x.x.x)
PortNot prominently displayed; always default5432
DatabaseDatabases tab in left sidebarpostgres
SchemaNot in console; default is publicpublic
UserUsers tab in left sidebarpostgres
PasswordUsers tab → three-dot menu → Change passwordSet at creation or via Users tab

Quick steps

  1. 1.Log in at console.cloud.google.com
  2. 2.Navigate to SQL from the left sidebar
  3. 3.Click your PostgreSQL instance name
  4. 4.Overview page → under "Connect to this instance," copy the Public IP address
  5. 5.Click Databases in the left sidebar to see available databases
  6. 6.Click Users to see usernames; use the three-dot menu to change/reset a password
  7. 7.Port is always 5432

Google recommends using the Cloud SQL Auth Proxy for production connections. For Chion, direct IP + SSL works for initial setup.

FieldWhere to FindDefault
Server (Host)Connect modal → displayed in connection stringep-<name>-<id>.us-east-2.aws.neon.tech
PortConnect modal5432
DatabaseConnect modal · selectable dropdownneondb
SchemaNot in UI; default is publicpublic
User (Role)Connect modal · selectable dropdownneondb_owner
PasswordShown in the connection string in the Connect modal(always visible in modal)

Quick steps

  1. 1.Log in at console.neon.tech
  2. 2.Select your project
  3. 3.Click the Connect button on the Project Dashboard
  4. 4.The "Connect to your database" modal opens
  5. 5.Select your Branch, Compute, Database, and Role from dropdowns
  6. 6.All connection parameters including password are displayed in the connection string
  7. 7.Toggle Connection pooling on/off to switch between pooled and direct connections

Password is always visible in the Connect modal; no need to reset.

FieldWhere to FindDefault
Server (Host)Connect → View parameters under "Direct connection"db.<project-ref>.supabase.co
PortSame panel · Direct: 5432, Transaction pooler: 65435432
DatabaseSame panelpostgres
SchemaNot shown in UI; default is publicpublic
UserSame panelpostgres
PasswordSet at project creation. Reset in Settings → Database(not displayed after creation)

Quick steps

  1. 1.Log in at supabase.com/dashboard
  2. 2.Select your project
  3. 3.Click the Connect button at the top of the page
  4. 4.Click "View parameters" under the Direct connection string
  5. 5.All fields (host, port, database, user) are displayed individually
  6. 6.Password must be the one you set at project creation (or reset it in Settings → Database)

Universal defaults

Standard PostgreSQL connection parameters.

Port5432
Databasepostgres
Schemapublic
SSL Moderequire (recommended for all cloud providers)

Safer than building it yourself: every query is read-only by construction

Architectural constraints, not configuration options.

Most text-to-SQL tools accept a database connection and generate queries. Chion goes further: every generated query passes through a multi-stage SQL validator (L1 enforces read-only SELECT at the syntax level, L2 applies mode-based restrictions) before execution. Credentials never leave the AES-256-GCM vault except inside the edge function for a single query's duration. Result sets are capped at 1,000 rows or 12,000 cells. Row-level security policies are honored on every query, and the language model never sees raw row data, only schema metadata and aggregated results. These are architectural constraints, not configuration options.

Read-only SELECT. AES-256-GCM credential vault. 1,000-row cap. Immutable audit log.

If you were planning to wire up a Postgres MCP server for Claude instead, that route is free and gives you full control of the tooling layer. What you build yourself, though, is only as safe as the role you grant it: there is no query validator, no credential vault, and no result cap unless you write them. Chion ships those constraints by default, and every verified query still exports as a portable skill you can run in Claude Code, Cursor, or Codex.

Connection string reference

Where each field lives in a standard Postgres connection string.

Generic PostgreSQL URI

postgres://<user>:<password>@<host>:<port>/<database>?sslmode=require

Neon

postgres://neondb_owner:REDACTED@ep-cool-forest-123456.us-east-2.aws.neon.tech/neondb?sslmode=require

Supabase (direct connection, port 5432)

postgres://postgres:REDACTED@db.abcdefghijklmnop.supabase.co:5432/postgres?sslmode=require

Supabase (transaction pooler, port 6543)

postgres://postgres.abcdefghijklmnop:REDACTED@aws-0-us-east-1.pooler.supabase.com:6543/postgres?sslmode=require

Amazon RDS for PostgreSQL

postgres://postgres:REDACTED@my-db.c9akciq32.us-east-1.rds.amazonaws.com:5432/postgres?sslmode=require

All passwords above are redacted. Chion stores your password encrypted in Supabase Vault (AES-256-GCM); it is never logged, never shown in the UI after save, and never sent to the language model.

Schema discovery query

List all available schemas after connecting.

SELECT schema_name 
FROM information_schema.schemata 
WHERE schema_name NOT IN ('pg_catalog', 'information_schema', 'pg_toast')
ORDER BY schema_name;

Troubleshooting common PostgreSQL connection errors

Solutions for the most frequent connection issues.

ERROR: permission denied for relation X

Your role can CONNECT to the database but not read the table. Grant SELECT on the specific relation and set default privileges so newly-created tables are readable too:

GRANT SELECT ON TABLE schema.relation TO chion_read;
ALTER DEFAULT PRIVILEGES IN SCHEMA schema
  GRANT SELECT ON TABLES TO chion_read;

SSL connection required or no pg_hba.conf entry for host

Chion connects with sslmode=require. On managed Postgres (Neon, Supabase, RDS, GCP, Azure), SSL is always enabled; if you still see this error, check your IP allowlist.

Connection timeout or connection refused on port 5432

The port is not reachable. Check your firewall or cloud security group allows inbound connections on 5432 from the public internet. On AWS RDS, edit the security group associated with your DB instance. On GCP Cloud SQL, add an authorized network.

Pooler port mismatch

If you see connection errors with a pooled endpoint, check the port. Supabase transaction pooler is port 6543. Azure PostgreSQL Flexible Server's built-in PgBouncer is port 6432. Direct PostgreSQL is always 5432.

database "X" does not exist

You entered the wrong database name. Default names vary by provider: postgres on RDS, Azure, GCP, and Supabase; neondb on Neon. Check your provider's dashboard or run \l inside psql to list databases.

FATAL: too many connections for role

Your role or database has hit the connection limit. Chion uses a small connection pool, so if you see this error it is usually another process. For Neon, check the compute's max connections setting. For RDS, check the max_connections parameter. For Supabase, switch to the transaction pooler on port 6543 instead of the direct 5432 endpoint.

Official provider documentation

Authoritative references for each managed PostgreSQL service. All open in a new tab.

Your credentials are encrypted

All connection credentials are encrypted with AES-256-GCM and stored in an isolated vault. Read-only by design: no INSERT, UPDATE, or DELETE is ever possible. PostgreSQL's row-level security policies apply to every query: Chion connects via your read-only role; your RLS policies decide what that role can see. The LLM never sees raw rows, only metadata and aggregated results.

Read our security model

Frequently asked questions

is it safe to let an AI tool query my production database

Yes. Chion is read-only by design. Every query is a SELECT, never INSERT, UPDATE, DELETE, or DROP, blocked by the L1 validator in code, not by LLM instruction, and an L2 lint enforces LIMIT and rejects SELECT * or invalid JOINs before execution. Credentials are AES-256-GCM encrypted in a vault, loaded once for the socket handshake over sslmode=require, and purged immediately. PostgreSQL Row-Level Security is enforced on every query, the AI model sees only schema metadata and aggregated results, never raw rows, and results are capped at 1,000 rows / 12,000 cells. Every access event is audit-logged.
Visit the Trust Center →

what database permissions does an AI SQL tool need

A dedicated read-only PostgreSQL role with CONNECT, USAGE, and SELECT on the schemas you want analyzed. No write privileges, no superuser, no replication role: Chion only issues SELECTs and the L1 validator enforces that in code, so elevated privileges would grant capabilities Chion cannot use. Grant only what you want Chion to see; Row-Level Security policies on your tables are honored on every query.
PostgreSQL setup guide →

can AI text-to-SQL point at a PostgreSQL read replica

Yes. Replicas are the natural target. Chion only issues read-only SELECTs, which maps perfectly to a replica endpoint: zero write risk, offloaded compute away from the primary, no impact on transactional workloads. Paste the replica's host into the connection string and the semantic layer builds against the replica's schema identically to the primary. The same applies to a Cloud SQL read replica.

does AI text-to-SQL work through PgBouncer transaction pooling

Yes. Chion direct-connects through PgBouncer in transaction pooling mode. Every query is a short-lived read-only SELECT, so there's no session-state binding for the pooler to break. For Supabase, use the Supavisor transaction pooler at port 6543. For Azure Flexible Server, use the built-in PgBouncer on port 6432. Deterministic execution, not ad-hoc connection churn.

which managed PostgreSQL hosts and versions does AI text-to-SQL support

Chion direct-connects to Amazon RDS (including Aurora PostgreSQL-Compatible), Azure Database for PostgreSQL (Flexible and Single Server), Google Cloud SQL for PostgreSQL, Neon, and Supabase. Self-hosted PostgreSQL reachable from Chion's egress works too. PostgreSQL 12 through 17 is supported with no server-side extensions required; standard tables, views, and materialized views are profiled into the semantic layer on connect, and PG 12+ unlocks the CTE inlining the WITH-clause queries rely on. The same two-layer validation runs identically across every host.

is an AI SQL tool safer than a DIY n8n or GPT-to-SQL pipeline

Yes, because the safety lives in code, not in the prompt. A DIY n8n or GPT-to-SQL pipeline sends model-generated SQL straight to your database, so an INSERT, UPDATE, or DELETE runs if the prompt drifts. Chion routes every query through an L1 read-only SELECT check and an L2 validator that reject anything but a read-only SELECT, caps results at 1,000 rows / 12,000 cells, keeps credentials in an AES-256-GCM vault, and honors PostgreSQL row-level security on every query. The model sees only schema metadata and aggregated results, never raw rows.

Ready to connect?

Open Chion, enter your credentials, and start asking questions in plain English.