Seaquel
PostgreSQL error code

PostgreSQL error 25006

25006 is the SQLSTATE PostgreSQL reports for read only sql transaction, in class 25, Invalid Transaction State.

SQLSTATE25006
Condition nameread_only_sql_transaction
Class25 — Invalid Transaction State

Reproduce it, then fix it

The transaction is read-only. In practice that means a read replica or default_transaction_read_only = on, and the fix is to send the write to the primary. Here the transaction is simply switched back to read-write. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SET TRANSACTION READ ONLY;
UPDATE products SET price = price * 1.1 WHERE id = 1;
SET TRANSACTION READ WRITE;
UPDATE products SET price = price * 1.1 WHERE id = 1 RETURNING id, price;

Source: PostgreSQL documentation, Appendix A