How to Configure n8n CockroachDB Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up n8n cockroachdb prevent delete rules, assign a read-only database role to your workflow. You can also revoke delete privileges from the user account that your workflow uses. Many teams start by giving their automation tool a standard admin user account. That broad role lets a bad prompt or faulty workflow wipe out production rows. How to set up n8n cockroachdb prevent delete in workflows First, understand how the workflow tool talks to your database cluster. CockroachDB speaks the P

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

To set up n8n cockroachdb prevent delete rules, assign a read-only database role to your workflow. You can also revoke delete privileges from the user account that your workflow uses. Many teams start by giving their automation tool a standard admin user account. That broad role lets a bad prompt or faulty workflow wipe out production rows.

How to set up n8n cockroachdb prevent delete in workflows

First, understand how the workflow tool talks to your database cluster. CockroachDB speaks the Postgres wire protocol, so teams use the Postgres node in n8n. In n8n, an AI Agent node links a chat model to one or more tools. The agent decides which tools to call to complete a task. You must attach at least one tool sub-node to an AI Agent node. For SQL tasks, the docs say to attach a Postgres tool sub-node to the agent. The old SQL Agent mode is deprecated from version 1.82.0 and removed in version 3.0. All current AI Agent nodes work as a Tools Agent instead.

To stop row removal natively, you create a dedicated user in your database cluster. You grant this user select, insert, and update permissions on the target tables. You leave out the delete privilege and any schema drop rights. Next, you save those user details inside the Postgres credential store in n8n. Every time the agent calls the Postgres tool sub-node, it logs in with that restricted user. If the workflow sends a delete statement, the database rejects the command right away.

Why database roles alone leave an operational gap

Native database roles solve the basic problem of who can log in. They also draw a hard line around which tables a user can touch. Still, static user roles are blunt tools for modern AI workflows. Sometimes a workflow needs to remove stale cache rows in one step. Yet you still want to block bulk deletes on customer tables in another step. If you grant delete rights for the cache task, the agent holds that power everywhere.

Database roles only check permissions at the table or schema level. They do not inspect what individual statements or requests do in flight. Also, a user with update rights can still overwrite columns with blank values. That action ruins data just as fast as a delete statement. Static roles also fail to protect sensitive fields during normal read queries. If an agent queries a customer table, the database returns raw emails and phone numbers. Native permissions cannot rewrite matched fields in results before the chat model reads them.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What to check before running agent workflows in production

Before you put an AI workflow live, review every tool sub-node attached to the agent. Besides built-in database nodes, n8n offers a Call n8n Workflow Tool and a Custom Code Tool. It also provides an HTTP Request Tool and a registry of MCP servers. Make sure none of these extra tools use a separate admin database account. Split your workflows so read tasks and write tasks use separate database users. Test your setup by asking the chat model to remove a test row. Confirm that the database blocks the action and returns a clear permission error. Finally, check how your team tracks every query that the agent runs. You need clear logs that show which workflow ran each SQL statement.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Which n8n node should I use to query CockroachDB with an AI agent?

Attach a Postgres tool sub-node to a current AI Agent node. CockroachDB uses the Postgres wire protocol, so the Postgres tool sub-node works natively.

Can the deprecated n8n SQL Agent block delete queries by itself?

No, the old SQL Agent converts natural language into SQL queries and runs them. It relies on the underlying database user permissions to block destructive commands.

What happens if an n8n user has update rights instead of delete rights?

The workflow cannot remove rows, but it can still set column values to null. You need statement-level rules to block risky updates alongside delete commands.

The query runs. The emails stay hidden.