PostgreSQL 9.3, set database (or all) to read only mode
default_transaction_read_only  might work for your case.
The command below will make new sessions start their transactions in read-only mode:
ALTER DATABASE name_of_database SET default_transaction_read_only to ON;

and to go back to normal:
ALTER DATABASE name_of_database SET default_transaction_read_only to OFF;

This takes effect for new sessions, not for sessions that are already connected.
The effect can also be obtained at the user level (which might be more convenient in some cases):
ALTER USER name_of_user SET default_transaction_read_only to ON;

While in read-only mode, a session can always issue SET default_transaction_read_only to OFF; to get out of this mode, or start any individual transaction with BEGIN read write;. But in general programs don't do that, so that default_transaction_read_only is sufficient to deny them the ability to write.