aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-12-11 06:40:38 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-12-11 06:40:38 +0900
commit07f0f1a8c7bcb3f789bb48bba7f4a485bfa317e9 (patch)
treef67c2408eba9d62896b8b8469746155002ed438a /activerecord/lib/active_record/connection_adapters/postgresql
parentcf71f31e2e152eceeb311aea6eadba3f2a814d81 (diff)
downloadrails-07f0f1a8c7bcb3f789bb48bba7f4a485bfa317e9.tar.gz
rails-07f0f1a8c7bcb3f789bb48bba7f4a485bfa317e9.tar.bz2
rails-07f0f1a8c7bcb3f789bb48bba7f4a485bfa317e9.zip
Don't treat begin and rollback transactions as write queries
Otherwise `save` method would raise the `ReadOnlyError` against `BEGIN` and `ROLLBACK` queries.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index d93c1f449e..0fd14fac0e 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -67,7 +67,7 @@ module ActiveRecord
end
end
- READ_QUERY = ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(:select, :show, :set) # :nodoc:
+ READ_QUERY = ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(:begin, :select, :set, :show, :savepoint, :rollback) # :nodoc:
private_constant :READ_QUERY
def write_query?(sql) # :nodoc: