Skip to content

ALC-3001: Connection is read-only

You asked for a change on a connection that is locked read-only, so Alcuin refused it before it reached the server. Nothing was changed.

For a statement that writes, run in a query tab outside a transaction, and for a commit of staged row or structure changes, Alcuin asks instead of refusing: Run this once? or Apply this once? (with on production on a production connection), with Run once or Apply once, and Unlock connection. See Run a single write once.

A dialog titled Run this once on production?, reading This connection is read-only. Run this once? The connection stays read-only afterward. A read-only database role is the only hard guarantee., with Cancel, Run once and Unlock connection.

Run once runs this statement and leaves the connection read-only; Unlock connection unlocks it.

Otherwise you see one of these messages, in the query tab, the table’s bar or the view you were using:

  • This connection is read-only. Unlock it to make changes.: running a statement that writes inside an open transaction, committing staged grant changes, or importing rows into a table.
  • This connection is read-only, and Analyze would run this statement. Unlock it, or explain without Analyze.: explaining a statement other than a plain SELECT with Analyze on.
  • This connection is read-only. Unlock it to act on sessions.: Cancel query or Terminate session in Activity, or Terminate session… in Health.
  • This connection is read-only. Unlock it to seed., and the same with to restore., to use checkpoints., to delete a checkpoint., to run maintenance. or to create a database., for those actions.
  • This connection is read-only. on its own, for actions on a linked project folder.

While a connection is read-only, the status bar shows Read-only. On a production connection, the banner reads Read-only. Nothing you do here can change data.

A connection opens read-only when either of these is on:

  • Open read-only in the connection’s settings. It is on by default for production.
  • Open read-only in Settings, under Safety, for the connection’s environment. Production’s rules can only be made stricter, so it stays on there.

A connection also locks again when Alcuin’s engine restarts, even if you had unlocked it.

Alcuin reads each statement before running it and refuses INSERT, UPDATE, DELETE, MERGE, COPY and statements that change structure. The server enforces read-only too: a write Alcuin cannot see in the text, such as a function that writes, fails with Postgres’ own message cannot execute UPDATE in a read-only transaction (SQLSTATE 25006) instead of this one.

  1. For one statement or one commit, choose Run once or Apply once in the dialog. The connection stays locked.
  2. To make more changes, unlock the connection with Unlock editing…: the button in the production banner, the connection’s menu in the connections list, or the command palette.
  3. Confirm with Unlock. On production the dialog asks Unlock editing on production?.
  4. Run or commit again.
  5. When you are done, lock it again with Lock in the production banner, or Lock editing.

An unlock lasts until you lock the connection or close it, or until the time set in Lock again after an unlock runs out: 15 minutes on production by default, Never elsewhere. Nothing is remembered for next time.

To explain without unlocking, turn off Analyze in the Explain options. The plan then comes from the planner alone and the statement does not run.

To have a connection open unlocked, turn off Open read-only in its settings, where your Safety rules allow it.

The engine reports this as ENGINE_READ_ONLY. Quote either name in an issue.