PostgreSQL · Natural language to code-validated SQL
Connect Postgres to Claude read-only. Your data stays where it is.
- Six fields: host, port, database, schema, user, password
- Saved queries compile into SKILL.md for Claude Code and Codex
Connecting Postgres to Claude takes six fields: host, port, database, schema, user, and password. Chion turns a plain-English question into a read-only SELECT, passes it through the application validators, executes it against your database, and shows the executed query beneath the chart. A Postgres MCP server hands Claude live tools against that database. A compiled skill carries the procedure and the text of a query someone on your team already saved and reviewed in Studio. The two cover different halves of the job: live access on one side, reviewed query knowledge on the other. Provider-specific steps live on the Neon, Supabase, Amazon RDS, Google Cloud SQL, and Azure pages. Jump to how SQL generation works.
Chion turns your PostgreSQL database into an analyst your team can question: connect read-only, ask in plain English, and save a query you have reviewed so the SQL skills generator can compile it. Your database becomes a question box the whole team can use, with no SQL to write and no write access granted. Credentials are wrapped in an AES-256-GCM vault, every query runs as a read-only SELECT capped at 1,000 rows, and the row-level security on the role you provide is honored on every call. It is the AI SQL workforce for teams on managed Postgres: connect in six fields. Point it at a read replica; your primary stays untouched. A query you saved and reviewed compiles into a portable SQL skill that runs in Claude Code and Codex.
How Chion connects to PostgreSQL
Five steps from role creation to interactive charts.
- 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
Enter 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
Paste into Chion
Open Chion, click Connect PostgreSQL, paste the six fields. Credentials are wrapped in an AES-256-GCM envelope, never logged, never shown to the language model, and only unsealed inside the edge function for the duration of one query.
- 4
Chion profiles your schema
Chion profiles table names, column types, and cardinality, and samples column values to learn your nomenclature. Those samples reach the model in the prompts that match your wording to your columns, except for columns classed as PII.
- 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.
| Field | Where to Find | Default |
|---|---|---|
| Server (Endpoint) | Connectivity & security tab → Endpoint | <instance>.<id>.<region>.rds.amazonaws.com |
| Port | Same tab, next to Endpoint | 5432 |
| Database | Configuration tab → DB name | postgres (or what you set at creation) |
| Schema | Not in console; default is public | public |
| User | Configuration tab → Master username | postgres (or what you set) |
| Password | Set at instance creation. Modify → change Master password to reset | (not retrievable) |
Quick steps
- 1.Log in at console.aws.amazon.com/rds
- 2.Click Databases in the left sidebar
- 3.Click your PostgreSQL instance name
- 4.Connectivity & security tab → copy the Endpoint and Port
- 5.Configuration tab → note the DB name and Master username
- 6.Password is what you entered during creation (use Modify to reset if needed)
| Field | Where to Find | Default |
|---|---|---|
| Server (Host) | Overview page → Server name | <server>.postgres.database.azure.com |
| Port | Overview or Connection strings page | 5432 |
| Database | Created by default. Check via Connection strings or psql | postgres |
| Schema | Not in portal; default is public | public |
| User | Overview page → Admin username | What you set at creation |
| Password | Set at creation. Reset via Settings → Reset password | (not retrievable) |
Quick steps
- 1.Log in at portal.azure.com
- 2.Search for "Azure Database for PostgreSQL servers"
- 3.Click your server name
- 4.On the Overview page: copy the Server name (this is your host) and note the Admin username
- 5.Click Connection strings in the left sidebar for pre-built connection strings
- 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.
| Field | Where to Find | Default |
|---|---|---|
| Server (Host) | Overview → Connect to this instance → Public/Private IP | IP address (e.g., 34.x.x.x) |
| Port | Not prominently displayed; always default | 5432 |
| Database | Databases tab in left sidebar | postgres |
| Schema | Not in console; default is public | public |
| User | Users tab in left sidebar | postgres |
| Password | Users tab → three-dot menu → Change password | Set at creation or via Users tab |
Quick steps
- 1.Log in at console.cloud.google.com
- 2.Navigate to SQL from the left sidebar
- 3.Click your PostgreSQL instance name
- 4.Overview page → under "Connect to this instance," copy the Public IP address
- 5.Click Databases in the left sidebar to see available databases
- 6.Click Users to see usernames; use the three-dot menu to change/reset a password
- 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.
| Field | Where to Find | Default |
|---|---|---|
| Server (Host) | Connect modal → displayed in connection string | ep-<name>-<id>.us-east-2.aws.neon.tech |
| Port | Connect modal | 5432 |
| Database | Connect modal · selectable dropdown | neondb |
| Schema | Not in UI; default is public | public |
| User (Role) | Connect modal · selectable dropdown | neondb_owner |
| Password | Shown in the connection string in the Connect modal | (always visible in modal) |
Quick steps
- 1.Log in at console.neon.tech
- 2.Select your project
- 3.Click the Connect button on the Project Dashboard
- 4.The "Connect to your database" modal opens
- 5.Select your Branch, Compute, Database, and Role from dropdowns
- 6.All connection parameters including password are displayed in the connection string
- 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.
| Field | Where to Find | Default |
|---|---|---|
| Server (Host) | Connect → View parameters under "Direct connection" | db.<project-ref>.supabase.co |
| Port | Same panel · Direct: 5432, Transaction pooler: 6543 | 5432 |
| Database | Same panel | postgres |
| Schema | Not shown in UI; default is public | public |
| User | Same panel | postgres |
| Password | Set at project creation. Reset in Settings → Database | (not displayed after creation) |
Quick steps
- 1.Log in at supabase.com/dashboard
- 2.Select your project
- 3.Click the Connect button at the top of the page
- 4.Click "View parameters" under the Direct connection string
- 5.All fields (host, port, database, user) are displayed individually
- 6.Password must be the one you set at project creation (or reset it in Settings → Database)
Settings that work on every provider.
Standard PostgreSQL connection parameters.
| Port | 5432 |
| Database | postgres |
| Schema | public |
| SSL Mode | require (recommended for all cloud providers) |
Read-only is enforced in code.
Architectural constraints, not configuration options.
Most text-to-SQL tools accept a database connection and generate queries. Chion runs each generated query 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 applies through the role you supply: its policies decide which rows come back. The model receives your table and column names, the rows your query returned for the narrative, and sampled column values. These are architectural constraints, not configuration options.
Read-only SELECT. Credentials in an AES-256-GCM vault. Results capped at 1,000 rows. Each executed query leaves one audit row: a query hash, the row count, and the mode. Never the SQL text. The write is fire-and-forget, so it never blocks the query.
A Postgres MCP server for Claude covers the other half of the job. It hands Claude live tools against the database and full control of the tooling layer, and it is free. What you wire yourself is only as safe as the role you grant it, because the query validator, the credential vault, and the result cap are yours to write. Chion ships those constraints by default. A query someone saves and reviews compiles into a portable skill you run in Claude Code or Codex, which is the knowledge an MCP connection alone does not carry.
How this compares to a Postgres MCP server
Where each one is the shorter path.
A Postgres MCP server runs on your machine and gives Claude Code a tool that executes SQL, so you own the process, the credentials file, and whatever the granted role allows. Chion holds the connection server-side under the read-only role you supply, code-validates every SELECT before execution, caps the result, and prints the statement that ran. Use the MCP server when you want the database local to your terminal. Use Chion when the executed SQL and the saved query library need to outlive the session.
Copy the connection string for your provider.
Where each field lives in a standard Postgres connection string.
Any other PostgreSQL host
postgres://<user>:<password>@<host>:<port>/<database>?sslmode=requireNeon
postgres://neondb_owner:REDACTED@ep-cool-forest-123456.us-east-2.aws.neon.tech/neondb?sslmode=requireSupabase (direct connection, port 5432)
postgres://postgres:REDACTED@db.abcdefghijklmnop.supabase.co:5432/postgres?sslmode=requireSupabase (transaction pooler, port 6543)
postgres://postgres.abcdefghijklmnop:REDACTED@aws-0-us-east-1.pooler.supabase.com:6543/postgres?sslmode=requireAmazon RDS for PostgreSQL
postgres://postgres:REDACTED@my-db.c9akciq32.us-east-1.rds.amazonaws.com:5432/postgres?sslmode=requireAll passwords above are redacted. Chion seals your password in an AES-256-GCM envelope; it is never logged, never shown in the UI after save, and never sent to the language model.
What Chion runs to read your schema.
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.
Read your provider's own docs.
Authoritative references for each managed PostgreSQL service. All open in a new tab.
- Amazon RDS PostgreSQL
Connection guide, endpoints, and Multi-AZ behavior.
- Azure PostgreSQL Flexible Server
Networking, PgBouncer, and TLS configuration.
- Google Cloud SQL for PostgreSQL
Public IP setup, authorized networks, and read replicas.
- Neon connection docs
Branches, pooled vs direct endpoints, and cold-start behavior.
- Supabase database connection guide
Direct vs Supavisor pooler ports and the auth schema.
- PostgreSQL CREATE ROLE
Reference for the read-only role pattern Chion uses.
Your credentials are encrypted
All connection credentials are encrypted with AES-256-GCM and stored in an isolated vault. Read-only by design: every generated statement is rejected in code unless it is a single read-only SELECT. 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 model receives your table and column names, the rows your query returned for the narrative, and sampled column values.
Read our security modelFrequently asked questions
Is it safe to let an AI tool query my production database?
What database permissions does an AI SQL tool need?
Can AI text-to-SQL point at a PostgreSQL read replica?
Does AI text-to-SQL work through PgBouncer transaction pooling?
Which managed PostgreSQL hosts and versions does AI text-to-SQL support?
Is an AI SQL tool safer than a DIY n8n or GPT-to-SQL pipeline?
Ready to connect?
Open Chion, enter your credentials, and start asking questions in plain English.