MariaDB or MySQL @@SESSION.tx_read_only always returns 0
another fiddle test
So both MariaDB  on tx_read_only and mysql on transaction_read_only have the session variable set to the current session value. The &quot;next transaction access mode&quot; remains hidden.
Catching insert errors seems like the only option.