Templates / Query your PostgreSQL data in plain English with GPT-4o-mini

Query your PostgreSQL data in plain English with GPT-4o-mini

Ready for 3.0

by Bhautik Trambadia ✓ · 137 views · created 2026-03-15 · Market Research, AI Chatbot

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 16 nodes and runs when a chat message arrives (plus 1 other trigger). Along the way it connects Postgres, OpenAI Chat Model, Postgres Chat Memory and Google Sheets and 1 more.

How it runs

Trigger: When a chat message arrives (plus 1 other trigger).

  1. Manage Table Name (Code): runs custom JavaScript code
  2. ⚙️ Config (Sync) (Edit Fields (Set)): sets 1 field: table_name
  3. Need Schema? (If): checks a condition and branches into true / false
  4. Truncate Table (Postgres): run a query
  5. Fetch Schema (Postgres): run a query
  6. Empty Schema (Edit Fields (Set)): sets 2 fields: columnList, conceptMap
  7. Fetch Google Sheet (Google Sheets): uses Google Sheets
  8. Format Schema (Code): runs custom JavaScript code
  9. Unified Analytics Agent (AI Agent): runs an AI agent, with model: OpenAI GPT-4o-mini; 2 tools (QuickChart, Execute SQL Query); memory: Chat Memory
  10. Insert Rows to Postgres (Postgres): uses Postgres

Services it uses

PostgresOpenAI Chat ModelPostgres Chat MemoryGoogle SheetsQuickChart

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Rarely used nodes in this template: n8n-nodes-base.quickChartTool

Nodes used (12)

From the author

AI SQL Analytics Agent Chat With Any PostgreSQL Database Using Natural Language This template turns your PostgreSQL database into an AI-powered analytics assistant. Instead of exporting data or uploading huge CSV files to an LLM, this workflow lets AI query…

Excerpt from Bhautik Trambadia's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.