When encountering the error 25006: Read Only SQL Transaction from a Postgres database, you should immediately take the following actions:
SHOW transaction_read_only;
in your psql session to see if your transaction is set to read-only.SELECT * FROM pg_settings WHERE name = 'default_transaction_read_only';
to verify if the database is operating in a read-only transaction mode by default.SELECT * FROM pg_stat_activity WHERE state = 'active';
to identify any active transactions that might be affecting your database's ability to write.SELECT pg_is_in_recovery();
. True indicates it is in recovery mode (read-only).SELECT * FROM pg_locks WHERE mode = 'ExclusiveLock' AND granted = 'f';
to find if there are any locks preventing write operations.SELECT datname, datallowconn, datistemplate, datallowconn FROM pg_database WHERE datistemplate = false;
.SELECT spcname, spcoptions FROM pg_tablespace;
.Taking these steps can help you identify why the PostgreSQL transaction is operating in read-only mode, allowing you to address the specific issue directly.
Let Dr. Droid create custom investigation plans for your infrastructure.
Start Free POC (15-min setup) →