PostgreSQL AI Integration
Text-to-SQL and AI analytics for PostgreSQL
Chion turns natural-language questions into verified SQL against your Postgres database. Read-only by design, credentials encrypted in vault, no data leaves your instance's result set. Works with Neon, Supabase, Amazon RDS, Google Cloud SQL, and Azure. Jump to how SQL generation works.
Chion is an AI SQL workforce for PostgreSQL teams. It connects to Neon, Supabase, Amazon RDS, Google Cloud SQL, and Azure.
Problem. Teams want plain-English questions answered from their production PostgreSQL, without ETL or warehouse copies. What Chion does. Direct read-only connection to Neon, Supabase, Amazon RDS, Google Cloud SQL, or Azure. Five connection fields, two-minute setup.
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
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
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
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
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)
Universal defaults
Standard PostgreSQL connection parameters.
| Port | 5432 |
| Database | postgres |
| Schema | public |
| SSL Mode | require (recommended for all cloud providers) |
How Chion compares
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.
Connection string reference
Where each field lives in a standard Postgres connection string.
Generic PostgreSQL URI
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 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.
- 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. Chion connects with read-only permissions. 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 modelFrequently asked questions
Which PostgreSQL versions does Chion support?
Is my PostgreSQL connection secure?
Does Chion support PostgreSQL read replicas?
Does Chion work with PgBouncer?
Does Chion work with PostgreSQL extensions like PostGIS, pgvector, or TimescaleDB?
How does Chion differ from other text-to-SQL tools?
Do I need a superuser or owner role for Chion?
Which managed PostgreSQL hosts does Chion support?
Ready to connect?
Open Chion, enter your credentials, and start asking questions in plain English.