aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-12-11 20:55:36 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-12-11 21:07:37 +0900
commit574234402433065e08a407be7cbdc900e5e0f1a3 (patch)
tree8057e982eb3b4e26a57ee94acdd075ea24b46945 /activerecord/lib/active_record/connection_adapters/postgresql
parentcb714c3687f6b0cf13bb4a0655d7b648e37239d7 (diff)
downloadrails-574234402433065e08a407be7cbdc900e5e0f1a3.tar.gz
rails-574234402433065e08a407be7cbdc900e5e0f1a3.tar.bz2
rails-574234402433065e08a407be7cbdc900e5e0f1a3.zip
An empty transaction does not raise the `ReadOnlyError` if preventing writes
BEGIN transaction would cause COMMIT or ROLLBACK, so unless COMMIT and ROLLBACK aren't treated as write queries as well as BEGIN, the `ReadOnlyError` would be raised.
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 a0cac07491..c70a4fa875 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(:begin, :explain, :select, :set, :show, :savepoint, :rollback) # :nodoc:
+ READ_QUERY = ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(:begin, :commit, :explain, :select, :set, :show, :release, :savepoint, :rollback) # :nodoc:
private_constant :READ_QUERY
def write_query?(sql) # :nodoc: