diff options
author | Ali Ibrahim <aibrahim2k2@gmail.com> | 2019-02-22 16:30:15 -0500 |
---|---|---|
committer | Ali Ibrahim <aibrahim2k2@gmail.com> | 2019-02-25 10:19:43 -0500 |
commit | b7eeb142afc332e04f902e9b630d9e44dbe4c55b (patch) | |
tree | 06f2563d0631cbbf1f99ca75c499d3f258c2f39e /activerecord/lib/active_record | |
parent | f4bef91a312954535c37f727c1bdbffaed64c2c1 (diff) | |
download | rails-b7eeb142afc332e04f902e9b630d9e44dbe4c55b.tar.gz rails-b7eeb142afc332e04f902e9b630d9e44dbe4c55b.tar.bz2 rails-b7eeb142afc332e04f902e9b630d9e44dbe4c55b.zip |
Update READ_QUERY regex
* The READ_QUERY regex would consider reads to be writes if they started with
spaces or parens. For example, a UNION query might have parens around each
SELECT - (SELECT ...) UNION (SELECT ...).
* It will now correctly treat these queries as reads.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index c1d846f58d..f205d77ddb 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -102,7 +102,7 @@ module ActiveRecord end def self.build_read_query_regexp(*parts) # :nodoc: - parts = parts.map { |part| /\A\s*#{part}/i } + parts = parts.map { |part| /\A[\(\s]*#{part}/i } Regexp.union(*parts) end |