PostgreSQL + Connect AI
Point any AI agent at your application database, OLTP store, or analytical Postgres. Connect AI handles schema search paths, JSON columns, and role-based visibility.
Table
View
Schema
Sequence
Function
MaterializedView
+ extensions, custom types
-- Ask Claude Code (or any MCP-aware agent): -- -- "In PostgreSQL, show me users who placed an order in the -- last 7 days, with their most recent order total." -- -- Claude generates and runs this SQL via the queryData MCP tool. -- Standard PostgreSQL syntax -- JSON, arrays, and CTEs all work. SELECT u.id, u.email, o.total AS most_recent_total, o.created_at FROM [PostgreSQL].[public].[users] u JOIN LATERAL ( SELECT total, created_at FROM [PostgreSQL].[public].[orders] WHERE user_id = u.id ORDER BY created_at DESC LIMIT 1 ) o ON true WHERE o.created_at >= NOW() - INTERVAL '7 days' ORDER BY o.created_at DESC LIMIT 25
Tutorials by AI surface
Working integrations for PostgreSQL + every supported AI surface.
Known quirks
Postgres looks up unqualified table names against the connection's search_path. Connect AI passes identifiers as fully-qualified [Catalog].[Schema].[Table], so search_path doesn't matter for queries the agent issues, but it does affect any raw SQL you paste from psql.
Postgres folds unquoted identifiers to lowercase but preserves case for quoted ones. A table created as "Users" won't match FROM users. Use getTables to discover the canonical case before writing queries.
JSON fields are accessible via -> and ->> operators or jsonb_path_query. Tell the agent the JSON shape in its system prompt, or expose a view that flattens common fields if the data is queried often.
If RLS policies are enabled, the agent only sees rows the connection's role is allowed to read. Connect AI doesn't bypass RLS. Create a least-privilege Postgres role for agent access and rely on RLS for tenant isolation.
Long-form recipes from the CData Knowledge Base.
Full API reference, authentication guides, and configuration details.