How to Configure JetBrains AI Postgres Read Only Access
You set up jetbrains ai postgres read only access by making a restricted database role. You then link that role to the database tool inside your code editor. Many teams start by sharing a standard developer login with their coding assistant. This fast path gives the assistant the same power as the human developer. If that role can edit tables or drop data, the assistant can too. A wrong prompt or bad suggestion can change live records in seconds. Building a read-only role stops the editor from
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.
You set up jetbrains ai postgres read only access by making a restricted database role. You then link that role to the database tool inside your code editor.
Many teams start by sharing a standard developer login with their coding assistant. This fast path gives the assistant the same power as the human developer. If that role can edit tables or drop data, the assistant can too. A wrong prompt or bad suggestion can change live records in seconds. Building a read-only role stops the editor from making accidental writes.
How to set up jetbrains ai postgres read only access
PostgreSQL controls data reading and writing through roles and object privileges. Instead of changing single user logins one by one, admins make a group role. You assign read permissions to the group role first. Then you add individual user roles into that group.
To allow reading, you grant the SELECT privilege on your target tables and views. PostgreSQL lets you grant SELECT on a whole table or on specific columns. This privilege also lets the user run data export commands on those tables. If a table holds secret columns, you can leave them out of the grant.
Still, a new role still gets some powers through the special PUBLIC role. By default, PUBLIC gives every role the power to log in to the database. It also lets every role make temporary tables and run functions and procedures. The database owner must revoke these defaults from PUBLIC if they pose a risk. If a function changes data, a read-only user with execute rights could trigger it.
You must also check the public schema rules on your database server. In PostgreSQL 15 and newer, users cannot create new objects in the public schema. Older servers, or upgraded ones, still let PUBLIC create objects there. On those servers, an admin must revoke create rights from PUBLIC on that schema. Once the role is tight, you put those login details into the editor.
Auditor Read-Only Access + AI Model Access Control: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they miss
A native read-only role solves the biggest risk of AI database use. It blocks the assistant from running insert, update, or delete commands on your tables. Even if the assistant writes a destructive query, the database rejects the command. You also get basic separation between human admin tasks and daily coding help.
Still, database roles only check who logs in and which tables they can read. They do not inspect what individual queries do while they run in flight. A read-only user with table access can still pull every row at once by default. If a table has emails, phone numbers, card numbers, or national IDs, SELECT returns them. Column grants can hide specific columns, but maintaining them across hundreds of tables is hard.
Also, static database roles still rely on passwords stored on developer laptops. Every engineer needs the role password saved inside their local editor settings. Rotating that shared password breaks the setup for everyone on the team. Native roles also do not mask sensitive text inside free-form columns during a query. When an assistant reads a table to write a query, raw values enter the prompt. Teams need a way to rewrite sensitive fields in results without rewriting every schema.
Add query and result controls beside Postgres
Grants and pools govern who logs into PostgreSQL. Yet every query in an open session still runs with that role's full scope. In practice, hoop.dev runs beside your database as a sidecar for your Postgres. It reads plain and prepared queries on the wire with no change to your users or drivers.
When a tool or agent sends SQL, hoop.dev Postgres controls check each statement against your deny rules. An AI Analyzer you configure can also score intent or hold a risky query for human review. Matched sensitive columns in result rows are masked in memory before they reach the caller. Each query and decision is logged per listener, which generates evidence for SOC 2, HIPAA, and GDPR audits. View the binary on GitHub.
Frequently asked questions
Can a PostgreSQL read-only role still change data through functions?
Yes, the special PUBLIC role grants execute rights on functions and procedures by default. If a function modifies table rows, a read-only user might still run it. Admins must revoke default execute rights from PUBLIC to stop this behavior.
Does granting SELECT on a table expose all columns to the coding assistant?
Granting SELECT at the table level lets the role read every column in it by default. PostgreSQL does allow admins to grant SELECT on specific columns instead of the whole table. Still, managing column-level grants across many changing tables takes heavy ongoing work.
Why can a read-only user still create tables in some PostgreSQL databases?
Databases running versions older than PostgreSQL 15 allow PUBLIC to create objects in the public schema. Databases upgraded from older versions keep this old setting unless an admin changes it. You must revoke create rights on the public schema from PUBLIC to fix this.
Related guides
In this post