PostgreSQL AI Ontology & Row-Governed MCP Connector
The fastest way to fail an enterprise security audit is dropping a generic PostgreSQL MCP container onto an internal database: the LLM guesses joins across unindexed JSONB columns, misinterprets soft-delete flags and runs under a static database role with zero per-employee masking. Naditu puts a deterministic ontology, row-level caller policies and pre-query refusal in front of PostgreSQL.
Streaming Read Replica · Scoped Read-Only Role · TLS
SQL mutations blocked · Writes routed to application APIs
Canonical ontology mapping
Business objects & field-level governance.
Instead of exposing raw physical tables to an LLM, Naditu assembles governed domain objects and enforces caller role policies at query time.
Customer & Tenant Account
Physical tables / entitiesaccounts · organizations · billing_profilesGovernance & masking ruleTenant / territory row filter & PII column maskingOrder & Line Transaction
Physical tables / entitiesorders · order_items · shipments · paymentsGovernance & masking ruleWholesale cost, fee & margin columns restricted by roleProduct & Warehouse Stock
Physical tables / entitiesproducts · skus · inventory_ledgersGovernance & masking ruleSupplier cost masked outside Purchasing & FinanceOperational Ticket & Event
Physical tables / entitiestickets · workflow_runs · audit_eventsGovernance & masking ruleClosed tables (auth tokens, HR, secrets) refused pre-query
| Business object | Physical tables / entities | Governance & masking rule |
|---|---|---|
| Customer & Tenant Account | accounts · organizations · billing_profiles | Tenant / territory row filter & PII column masking |
| Order & Line Transaction | orders · order_items · shipments · payments | Wholesale cost, fee & margin columns restricted by role |
| Product & Warehouse Stock | products · skus · inventory_ledgers | Supplier cost masked outside Purchasing & Finance |
| Operational Ticket & Event | tickets · workflow_runs · audit_events | Closed tables (auth tokens, HR, secrets) refused pre-query |
Why raw SQL & generic MCP fail
Three physical schema traps solved in the layer.
Every operational system carries implicit join keys, status discriminators and multi-company rules that ungrounded Text-to-SQL guesses wrong.
- 01
Soft-deleted rows (deleted_at IS NOT NULL) and draft state rows
Application schemas frequently retain cancelled or soft-deleted rows in active tables. Naditu bakes active-record predicates into every canonical object definition.
- 02
Polymorphic associations and untyped JSONB payload columns
Microservice databases drop foreign-key constraints in favor of polymorphic entity_type/entity_id pairs and JSONB blobs. The ontology records verified join paths and typed JSONB paths.
- 03
Money stored in minor units (cents/kuruş) alongside decimal columns
Mixing integer cent columns with numeric currency columns causes 100x reporting errors in raw Text-to-SQL. Naditu normalizes units and currency codes explicitly.
Common engineering questions.
Why not use Anthropic’s reference PostgreSQL MCP server in production?
Reference database MCP servers expose raw schema inspection and unrestricted SELECT execution under one shared connection string, with no IdP user mapping, no column masking, no business dictionary and no cross-system joins.
How does Naditu protect production PostgreSQL OLTP performance?
Naditu connects to a hot-standby read replica using a read-only role with statement_timeout, row limits and blocked DDL/DML verbs.
Can PostgreSQL tables be joined with SAP, Logo or Salesforce in one question?
Yes. Custom internal PostgreSQL applications join cleanly with commercial ERPs and CRMs inside the same ontology.
Engineering deep dives
Related architecture notes from the blog.
Wren AI and Vanna AI Text-to-SQL alternative for ERP data
Comparing Wren AI (MDL + DataFusion) and Vanna AI (RAG DDL vectors) against an enterprise ontology for live multi-ERP queries, RBAC, and write gates.
CData MCP, Cube, and dbt Semantic Layer limits
How CData Connect AI MCP, Cube, and dbt Semantic Layer compare to an enterprise ontology when AI agents need ERP status codes and write gates.