Skip to content

feat: adding read only mode#346

Open
jay-babu wants to merge 4 commits into
kristijanhusak:masterfrom
jay-babu:master
Open

feat: adding read only mode#346
jay-babu wants to merge 4 commits into
kristijanhusak:masterfrom
jay-babu:master

Conversation

@jay-babu

Copy link
Copy Markdown

tested with postgres. does something similar to datagrip and lazysql
where the enforcement is based on parsing the input and not a parameter
in a connection

tested with postgres. does something similar to datagrip and lazysql
where the enforcement is based on parsing the input and not a parameter
in a connection
@reegnz

reegnz commented Jun 11, 2026

Copy link
Copy Markdown

For postgresql it makes more sense to control this in the connection URL itself:
https://kmoppel.github.io/2025-03-27-til-starting-in-read-only-the-easy-way/
https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-READ-ONLY

So specifically for postgres if you want to make 'read_only' a 1st-class dbui feature, it should set that connection flag in the connection url for psql instead of a messy query parsing. But I think this should be fully handled at the connection URL level and vim-dadbod-ui should stay oblivious to it. Keep it simple.

Example connection URL:

postgresql:///postgres:postgres@127.0.0.1:5432/postgres?options=-cdefault_transaction_read_only%3Don

With this you get messages like:

ERROR:  cannot execute CREATE TABLE in a read-only transaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants